This PR addresses a bug where the date parsing in NightscoutUtils fails when the device is set to a 12-hour time format. The issue stems from the DateFormatter not being explicitly set to a locale that supports 24-hour time formats, which can lead to inconsistencies based on the user's device settings.
Changes
Set the locale of dateFormatterWithMilliseconds and dateFormatterWithoutMilliseconds in NightscoutUtils.parseDate to en_US_POSIX. This locale is designed for machine-readable strings and ensures that the date parsing behavior is consistent, regardless of the user's regional and time format settings.
Overview
This PR addresses a bug where the date parsing in
NightscoutUtils
fails when the device is set to a 12-hour time format. The issue stems from theDateFormatter
not being explicitly set to a locale that supports 24-hour time formats, which can lead to inconsistencies based on the user's device settings.Changes
dateFormatterWithMilliseconds
anddateFormatterWithoutMilliseconds
inNightscoutUtils.parseDate
toen_US_POSIX
. This locale is designed for machine-readable strings and ensures that the date parsing behavior is consistent, regardless of the user's regional and time format settings.