Open skatkov opened 7 years ago
Here is a resulting request to tsheets server. Didn't yeat found where this uri is formed.
+ method: get
+ uri: https://rest.tsheets.com/api/v1/timesheets?modified_since=Sat,%2010/07/17%20%201:52%20PM&page=0
+ body:
+ encoding: US-ASCII
+ string: ''
Hi, @skatkov,
The reason you're obtaining the error is that the variable start_date
isn't in the expected format. You need to provide the date in the ISO-8601 format. In your case, this would be 2017-10-17
.
If you're using Rails, you can convert your start_date
variable to a Time
object and then call start_date.to_time.iso8601
to get it in a valid format.
I hope that helps. If you have any questions, let me know!
@rogerogden I've tried that before, unfortunately gem demands certain object (DateTime) -- using start_date.to_time.iso8601
returns a string
and gem throws error for that, demanding to provide DateTime.
Unfortunately, DateTime later on get's formatted not according to iso8601. I'm really not sure why that happens.
@skatkov I think you might be able to get away with passing the returned string from the start_date.to_time.iso8601
call to a DateTime object's parse
function. Here's the documentation.
Format sent to tsheet api is not accepted.
TSheets::ExpectationFailedError: TSheets::ExpectationFailedError: 'start_date' date [Sat, 10/07/17 12:00 AM] is not in valid ISO-8601 date only format
code:
system:
OSX
ruby -v ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]