Using new Date() in a suitlet returns pacific time...
# suitescript
n
Using new Date() in a suitlet returns pacific time. I want to set a TIMEOFDAY field with the user preference time zone. How do I do that?
b
thats new, and probably a bug you want to bring up with support
n
@battk basically doing this sets it to pacific time and not the user preference like a date time field does
Copy code
schedulerec.setValue({ fieldId: 'custrecord_dc_schedule_start_time', value: new Date()})
b
bug to netsuite support
s
new? I thought the suitelet code (running server side) will generally return pacific time since that's where the servers are located?
b
it used to be smart enough to convert it to the correct timezone
it no longer is
n
yes @Shawn Talbert that is what is happening. When i set a date time field it uses user preference and coverts date correctly but not when doing on a TIME OF DAY field
s
@battk you're saying the internals of
setValue
would convert server timezone into user preference time zone behind the scenes?
b
it was similar to format.format in that it would convert the pacific timezone Date into a datetime string that used the user's timezone
n
i tried format.format and it didn't change anything
i even set the timezone to a different one in format.format and it didn't change
s
maybe TIMEOFDAY forgot to get that treatment
b
it used to
it doesnt now
n
that is what i figured out basically so trying to figure out another way
b
start on the support case now
s
I have the same issue with new Date ()
For client script
k
Same has happneed to me i tend to parse then format which then picks up the account prefernce.