apostrophecms/apostrophe-events

Use of "T" in "sanitizeDateAndTime" when building date objects gives wrong timezone

Closed this issue · 0 comments

 piece.start = new Date(startDate +'T'+ startTime);
 piece.end = new Date(endDate +'T'+ endTime);

You should use a space instead of the T.

The "T" means "this is in UTC." With a space, you get the server's timezone, i.e. where our client is, and we don't get surprising results when we pull this data back out and format it with moment, or try to determine whether an event has ended.

There is a larger discussion to be sure about events that happen in multiple timezones, but this is not something our clients have been eager to address. We shouldn't throw in the T without a bigger discussion around that, for now the space is correct for what we do.