20205456589 is shorter than 202042833969. how can...
# suitescript
m
20205456589 is shorter than 202042833969. how can i ensure the length is always the same?
b
if you have a choice in the matter, i recommend using
new Date().toISOString()
if you really require your date to be in a certain format (and in PST) then the overkill solution is moment.js
minimal solution is formatting your number as a string and padding it so that its length is what you want. You can take a look at pad-left if you want a fast solution
m
thank you for suggesting pad-left. what would I have done with toISOString() ?
b
it would give you a nicely formatted string
importantly in a standard format
m
ah - understood. will use toISOString going forward