How can I present `Date/Time` to the user in their...
# suitescript
d
How can I present
Date/Time
to the user in their timezone and format? (I feel like we should build a blog post on this or something)
e
Moment.js? Or a similar lightweight library
d
Its hard for me to believe this can't be done natively ... plus, will we not need input from the NetSuite environment to get the timezone/format correct? I use momentjs all the time for date manipulation and calculations, but never UI formatting.
s
whats the context of that? runtime.getCurrentUser().getPreference("TIMEZONE") should land you the timezone, and you'd probably do some serverwidget fields on top if you want to manipulate. Something like that?
m
Isn't that what the
N/format
module is for? To format different things using the user's preference?
r
There is a third parameter in the
N/format
module where you can submit the timezone you want to use.
s
i think the wild solution without a large mapping table is to have a user -> user settings -> timezone fed in the timezeone of datafeed? Either that or company settings at GMT, or at source timezone and the user accepts what they see?