Quick question, Since moment gives time of the ser...
# suitescript
t
Quick question, Since moment gives time of the server, do I have to use moment-timezone separately to translate it to some other timezone?
b
occasionally you can get away with using N/format if you are just working with data within NetSuite and not sending it in or out
otherwise mement-timezone
t
Yeah, I am sending that out.
How would both these work together.
In the docs I could see something like
moment().tz("America/New_York").format()
b
not really sure what you mean by both, you dont really want to use moment objects with N/format
at best, you convert to and from Dates
t
Just to provide more context, I need a timestamp in format ‘2021-11-19T141919+05:30’
by server.
Yes, for India. I can easily get similar by moment.format(), but not in Indian time zone.
b
moment timezone will get you there
although you will predictably not be using America/New_York as the timezone
t
yes, you are right.
Hey, figured it out man.
Thanks.
I had to import one library in my code that’s moment-timzone, but moment being a dependency will come automatically.
Had to change in path in moment-timezone for that.
It works now.