Dates Displaying One Day Off When Listed Without Times
The discussion revolves around an issue with the automatic date function in Discourse, where dates are displayed one day earlier when listed without times. DiscoWebmaster first reported the issue, stating that dates are displayed incorrectly, always one day before the actual date.
Codinghorror chimed in, suggesting that the issue may be related to time zones. DiscoWebmaster questioned why the default time zone is set to LA instead of the user’s or website’s time zone.
Awesomerobot proposed a possible solution, suggesting that the issue is caused by the lack of a time zone in the date format. They provided an example of how to correctly format the date with a time zone.
Later, Slowhand reported a similar issue with the “Insert Date/Time” feature, where the calendar always defaults to yesterday. Zogstrip brought the issue to the attention of joffreyjaffeux, who provided a link to a GitHub pull request that should fix the issue.
Huh… Why does it default to LA? Should it not default to the user’s time zone or at least the website time zone? (The Discourse that I posted on was set to ET/NY so should be correct)
Are you manually typing out the date without the timezone or removing the timezone? I believe without the timezone it’s interpreting the date as UTC and converting it to your local timezone. (It’s currently the 7th in UTC, but the 6th in EST)
This is what it looks like when I click insert:
[date=2019-03-03 timezone="America/New_York"]
Which is correctly rendered as 2019-03-03T05:00:00Z
On hover we’re providing a reference to multiple timezones, to give some context that this is a localized date/time. If you click advanced mode in the insert date menu, you can change which timezones are displayed on hover.
I have a similar but different question about the “Insert Date/Time” feature.
Why does the part on the right side always default to yesterday?
I almost always use the right side since I need to input a time and on days like today, I have to do the extra step of changing the calendar to August.