Skip to content

Commit 6345152

Browse files
committed
commit fix #1895
1 parent 7e0b561 commit 6345152

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

grails-app/assets/javascripts/utils.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ function convertToSimpleDate(isoDate, includeTime, showInUserTimeZone) {
9191
}
9292

9393
var date;
94-
if (showInUserTimeZone === true) {
95-
// use the user’s local timezone
96-
date = moment(isoDate);
94+
if (showInUserTimeZone === false) {
95+
// keep the date in UTC
96+
date = moment.utc(isoDate);
9797
}
9898
else {
99-
// keep the date in UTC to avoid shifting it for other viewers
100-
date = moment.utc(isoDate);
99+
// default to user's local timezone
100+
date = moment(isoDate);
101101
}
102102

103103
var format = includeTime ? "DD-MM-YYYY HH:mm" : "DD-MM-YYYY";

src/integration-test/groovy/au/org/ala/ecodata/forms/DateSpec.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ class DateSpec extends GebReportingSpec {
5454
title == "Preview Date example"
5555

5656
and: "The values from the data model are displayed"
57-
$("span[data-bind*=date1").text() == "01-07-2019"
58-
$("span[data-bind*=date2").text() == "01-08-2019"
59-
$("span[data-bind*=date3")*.text() == ["01-09-2019", "01-11-2019"]
60-
$("span[data-bind*=date4")*.text() == ["01-10-2019", '']
57+
$("span[data-bind*=date1").text() == "02-07-2019"
58+
$("span[data-bind*=date2").text() == "02-08-2019"
59+
$("span[data-bind*=date3")*.text() == ["02-09-2019", "02-11-2019"]
60+
$("span[data-bind*=date4")*.text() == ["02-10-2019", '']
6161
}
6262

6363
}

0 commit comments

Comments
 (0)