Dates displaying one day off when listed without times

Hello,

While using the automatic date function today I found out that the date is not displaying correctly if listed without a time. For example:

2019-03-04T00:00:00Z

Despite listing it as March 3rd The text above here is actually:

[date=2019-03-04]

but displays incorrect as March 3rd.

This seems to occur with any date, it is always one day before.

EDIT:

It should be noted that this also occurs in the preview window:

Looks correct to me per the hover / mouseover tooltip

3 Likes

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)

…and for that matter, why is there a time listed on the hover?

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.

10 Likes

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.

image

1 Like

That indeed looks bad. @joffreyjaffeux, can you have a look?

2 Likes

Should be fixed by:

https://github.com/discourse/discourse/pull/7968

3 Likes