1554026400 should be 03/31/2019 @ 10:00am (UTC) -> 31.3.2019 12:00 (CEST)
1553940000 should be 03/30/2019 @ 10:00am (UTC) -> 30.3.2019 11:00 (CET)
using Toybox.WatchUi;
using Toybox.Application as App;
using Toybox.Time;
using Toybox.Time.Gregorian as Calendar;
class DataFieldTestView extends WatchUi.SimpleDataField {
function initialize() {
SimpleDataField.initialize();
label = "Time Test";
}
function compute(info) {
var time = 1554026400; // 03/31/2019 @ 10:00am (UTC) -> 31.3.2019 12:00 (CEST)
// var time = 1553940000; // 03/30/2019 @ 10:00am (UTC) -> 30.3.2019 11:00 (CET)
var nextDate = Calendar.info(new Time.Moment(time), Time.FORMAT_SHORT);
var dateString = Lang.format(
"$1$.$2$.$3$ $4$:$5$",
[
nextDate.day,
nextDate.month,
nextDate.year,
nextDate.hour,
nextDate.min.format("%02d")
]
);
return dateString;
}
}
If I run both examples on Simulator, everything works perfect, data field presents the expected values:
1554026400 31.3.2019 12:00
1553940000 30.3.2019 11:00
Running on the device the result is:
1554026400 31.3.2019 11:00
1553940000 30.3.2019 11:00
Looks like the device is not considering clock change in the future and takes current time zone. Is this correct? Or am I thinking wrong. Is there any workaround?
My FR645M setting is time setup = auto