API View has issues with timezones
Hello,
I am using the API to print a list of items using a view as a filter.
I am using PodioItem::filter_by_view($app_id,$viewid,array('limit' => 500)) to get the data using PHP.
The problem is that when the results are supplied by the API, any date filters seem to be in UTC, so in Australia where I am, my list updates to the current day at 11am each morning (because we are 11 hours behind UTC).
Is there some way of setting the timezone for the API to operate off or is this a bug?
Cheers, Jon.
-
Do we have any update on this issue?
I have a custom view of items filtered by month (not using "current month" but the calendar picker by selecting the first day and the last day of the month). The timezone is set to America/Santiago. The date comes back as UTC when authenticating using app.
The problem is the conversion from American/Santiago to UTC is done before my custom view is filtered. For instance, an item with a date of 31/01/2016 21:00 America/Santiago -3, which should be in the my view of January, after the API call, it gets placed incorrectly into February (01/02/2016 00:00 UTC).
What is the best way to solve this? Wouldn't it make more sense to do the conversion after the items have been filtered? That way the API returns exactly the same items as in the app, even if the results end up in a different timezone, in this case UTC. Then I can just change it back to America/Santiago using something like Moment.js.
Please sign in to leave a comment.
Comments
4 comments