This comes from a discussion in the Slack chatroom.
natefaubion
If you have a timezone offset, you can adjust the datetime before giving it to formatters
Maybe something should be in purescript-now for getting the current user timezone offset
The time zone offset returned is the one that applies for the Date that it’s called on. Where the host system is configured for daylight saving, the offset will change depending on the date and time that the Date represents and that daylight saving applies.
Right, so it has to be for the date you give it
Yeah, I doubt anything in PS is going to exist for that natively
But it seems to me like something that could exist in purescript-now, given an instant, get the user’s timezone offset
I say purescript-now, because it’s the only effectful date agnostic library
Full thread:
unisay [8:25 AM]
How to format DateTime such that user sees time in his own timezone? I looked at purescript-formatters but there is no TimeZone support - its all UTC; Please advise
hdgarrood [8:26 AM]
it's possible that there just isn't a purescript library for this
we're using bindings to moment.js at lumi
dariooddenino [8:27 AM]
Yeah, I'm using FFI and luxon.js
unisay [8:27 AM]
@hdgarrood we also use moment.js at collegevine (but from inside of JSX), are your bindings open-sourced?
hdgarrood [8:27 AM]
don't think so unfortunately
unisay [8:28 AM]
@dariooddenino do you happen to have it as a library?
dariooddenino [8:28 AM]
No, I just wrapped a handful of functions I'm using
it's not a lot of work though
unisay [8:28 AM]
Thanks to y’all
dariooddenino [8:29 AM]
I can put up a gist if you want, but it's not very safe code 😄
natefaubion [8:32 AM]
If you have a timezone offset, you can adjust the datetime before giving it to formatters
Maybe something should be in purescript-now for getting the current user timezone offset (edited)
dariooddenino [8:33 AM]
and then daylight saving times come to bite you
natefaubion [8:35 AM]
Does the JS date machinery not account for that given the current time?
The time zone offset returned is the one that applies for the Date that it’s called on. Where the host system is configured for daylight saving, the offset will change depending on the date and time that the Date represents and that daylight saving applies.
Right, so it has to be for the date you give it
Yeah, I doubt anything in PS is going to exist for that natively
But it seems to me like something that could exist in purescript-now, given an instant, get the user’s timezone offset
I say purescript-now, because it’s the only effectful date agnostic library
This comes from a discussion in the Slack chatroom.
natefaubion
If you have a timezone offset, you can
adjustthe datetime before giving it to formattersMaybe something should be in
purescript-nowfor getting the current user timezone offsetRight, so it has to be for the date you give it
Yeah, I doubt anything in PS is going to exist for that natively
But it seems to me like something that could exist in purescript-now, given an instant, get the user’s timezone offset
I say purescript-now, because it’s the only effectful date agnostic library
Full thread:
unisay [8:25 AM]
How to format
DateTimesuch that user sees time in his own timezone? I looked atpurescript-formattersbut there is no TimeZone support - its all UTC; Please advisehdgarrood [8:26 AM]
it's possible that there just isn't a purescript library for this
we're using bindings to moment.js at lumi
dariooddenino [8:27 AM]
Yeah, I'm using FFI and luxon.js
unisay [8:27 AM]
@hdgarrood we also use moment.js at collegevine (but from inside of JSX), are your bindings open-sourced?
hdgarrood [8:27 AM]
don't think so unfortunately
unisay [8:28 AM]
@dariooddenino do you happen to have it as a library?
dariooddenino [8:28 AM]
No, I just wrapped a handful of functions I'm using
it's not a lot of work though
unisay [8:28 AM]
Thanks to y’all
dariooddenino [8:29 AM]
I can put up a gist if you want, but it's not very safe code 😄
natefaubion [8:32 AM]
If you have a timezone offset, you can
adjustthe datetime before giving it to formattersMaybe something should be in
purescript-nowfor getting the current user timezone offset (edited)dariooddenino [8:33 AM]
and then daylight saving times come to bite you
natefaubion [8:35 AM]
Does the JS date machinery not account for that given the current time?
Right, so it has to be for the date you give it
Yeah, I doubt anything in PS is going to exist for that natively
But it seems to me like something that could exist in purescript-now, given an instant, get the user’s timezone offset
I say purescript-now, because it’s the only effectful date agnostic library