Related Issue
Description
Gregorian.info() handles DST incorrectly for dates other than now/today (works in sim, not on device).
In the sim, if I create a moment for some other date outside of the current DST/non-DST period, Gregorian.info() outputs local time correctly (with the correct adjustment/non-adjustment for DST).
On a real device, the same test will produce output which acts as if the supplied date is today, for the purpose of DST adjustment.
It's as if the device doesn't have/use TZ info for dates other than today, but the sim does.
(EDIT: of course, naturally this would work in the sim, as the underlying OS -- such as windows -- would have correct TZ/DST handling.)
Recreation Procedure
Create a simple data field with the following compute() method:
function compute(info) { var timeInfo = new [2]; var moment; // My timezone is Eastern Time // (On the current date (March 17), the timezone offset is UTC-4) // // On December 1, the timezone offset is UTC-5 moment = Gregorian.moment({ // despite docs, this input appears to be interpreted as UTC time :year => 2021, :month => 12, :day => 1, :hour => 16, :minutes => 0, :seconds => 0 }); timeInfo[0] = Gregorian.info(moment, Time.FORMAT_MEDIUM); // On July 1, the timezone offset is UTC-4 moment = Gregorian.moment({ // despite docs, this input appears to be interpreted as UTC time :year => 2021, :month => 7, :day => 1, :hour => 16, :minutes => 0, :seconds => 0 }); timeInfo[1] = Gregorian.info(moment, Time.FORMAT_MEDIUM); // On the sim this returns "Dec: 11 | July: 12", as expected // // On a real 935 this returns "Dec: 12 | July: 12". The TZ offset // seems to be calculated from the current time/date, not the given time/date return "Dec: " + timeInfo[0].hour + " | July: " + timeInfo[1].hour; }
On the sim this returns "Dec: 11 | July: 12", as expected. My timezone is Eastern Time, which is UTC-5 in December (DST) and UTC-4 in July (non-DST).
On a real 935 this returns "Dec: 12 | July: 12". Today is March 17 and DST is active. The TZ offset used to calculate local time seems to be calculated from the current time/date, not the given time/date
Environment
- Windows 10
- VS Code
- SDK 3.2.5
- Garmin 935 21.00