When you have a column of type 'date string' and the data does not have a time component (e.g. "2018-07-11"), the displayed day is being set to the day before ("10-07-2018"). Ideally, this does not happen. Here's a fiddle showing the problem: http://jsfiddle.net/4bfhwvdz/1/
Hello, Patrick,
Thank you for writing!
Please check the following tutorial: https://www.flexmonster.com/doc/date-and-time-formatting/#managing-timezones. There you can find our recommendations regarding such kind of issues.
Let me know if it helps.
Regards,
Tanya
That would be fine if my date actually had a time associated with it, but it does not, so timezone should not affect it. No matter which way you slice it, underlying data of 2018-07-11 should not display as 2018-07-10 automatically, or there should at least be a setting to prevent that.
When I use type date, the same problem does not occur http://jsfiddle.net/xbpf2094/
Hello Patrick,
Thank you for the feedback.
Please check the following sample: http://jsfiddle.net/flexmonster/4bfhwvdz/14/ (see line 19 with`datePattern` property)
and let us know if it works fine for you.
A bit of explanation. We use the standard JavaScript Date.parse()
function to parse dates. The browser can parse dates by applying both local and UTC time zones. And Flexmonster renders dates by default in the local time zone. So, in case your time zone is behind UTC (i.e. GMT-05:00), the browser will parse `11-07-2018` as UTC time and convert to local (`10-07-2018 19:00:00`). If the date has time part, the browser will parse it in local time zone. That's why you see the difference.
Our recommendation is to use all date in the same format to prevent time offset issues.
Hope it was helpful.
Regards,
Ian
Thanks Ian, very helpful. So is there any way I can use different date formats for different columns? For example I know one column will always include a time part so I'm fine showing local time there, but a different column will only include date information so I need to use UTC time in that situation. Right now I only see the global option for date pattern.
Thanks for your help!
^ For the above, seems like datePattern could be a good addition to the 'Format' object for each object
Patrick,
Thank you for the answer.
Actually, we have `datePattern` for `date string` type and `dateTimePattern` for `datetime` type: http://jsfiddle.net/flexmonster/yt396k5d/
As for the `Format` object, it was designed to format `number` values mainly.
In practice, we have rare cases when it's needed to have individual date/time formats.
Regards,
Ian
Hey Ian, I think I can work with that for now, I know it would be nice to allow different date formats for different columns in the future (I know our users sometimes like to format different date columns in different ways) just in case you want to put that on a feature request backlog at some point.
Thanks for your help with everything