if you have a choice in the matter, i recommend using
new Date().toISOString()
battk
05/08/2020, 11:02 PM
if you really require your date to be in a certain format (and in PST) then the overkill solution is moment.js
battk
05/08/2020, 11:07 PM
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
mg2017
05/08/2020, 11:10 PM
thank you for suggesting pad-left. what would I have done with toISOString() ?
b
battk
05/08/2020, 11:13 PM
it would give you a nicely formatted string
battk
05/08/2020, 11:14 PM
importantly in a standard format
m
mg2017
05/08/2020, 11:15 PM
ah - understood. will use toISOString going forward