Fix DST display bug in Accessed and a few other date fields

If you entered a date that was in DST (including the current date at
00:00:00) but you were in standard time, the previous day was displayed.

Since access dates for saved items include explicit timestamps and most
people don't work between the hours of midnight and 3 a.m., this didn't
come up very often, and it was easy to miss when it did, since you'd be
unlikely to notice it for previously entered dates. (Someone noticed it
today because DST ended in Australia.)

This only affected the item pane, so citations were unaffected.
This commit is contained in:
Dan Stillman 2018-04-01 07:45:11 -04:00
parent 53df1b8dae
commit 0b384abe66

View file

@ -1308,7 +1308,10 @@
if (date) {
// If no time, interpret as local, not UTC
if (Zotero.Date.isSQLDate(valueText)) {
date = Zotero.Date.sqlToDate(valueText);
// Add time to avoid showing previous day if date is in
// DST (including the current date at 00:00:00) and we're
// in standard time
date = Zotero.Date.sqlToDate(valueText + ' 12:00:00');
valueText = date.toLocaleDateString();
}
else {