Can FlicScript Add Support for Local Timezones (with DST)
-
One of my scripts changes brightness based on the current time. I've noticed that FlicScript always uses UTC time, and there is no way to set a timezone in the app or even in code. When using
new Date().toLocaleString('en-US', {timeZone: 'America/Los_Angeles'})
the UTC date is still returned.It isn't too hard to just get the UTC time and change the hours offset manually (which I'm currently doing), but it becomes a hassle when changes with Daylight Savings Time is factored in.
Would is be possible to add a way to set the timezone in the app or something so that
new Date()
returns the date in the specified timezone (or the current location and timezone could be detected automatically), or at least maketoLocaleString
work properly so timezones can be adjusted manually an have DST accounted for automatically.Thank you!
-
@Emil Thanks for getting back to me. So no chance on adding
Intl.DateTimeFormat
API support to FlicScript or including a way to set the timezone in the app that is passed down into FlicScript? -
@pico As you can see on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString, the parameters supplied are only used if the Intl.DateTimeFormat API is supported. We don't support that API and hence you can't get any time zone support, unfortunately.
I would suggest you to manually extract the components using getUTCHours, getUTCMinutes, getUTCSeconds etc. and then apply your time zone offset and DST formula manually, which should be doable if you know you will only be using a fixed time zone.