Hi I need get previous date when my script schedul...
# suitescript
m
Hi I need get previous date when my script schedule execute I may only get this date with moment js?
e
Previous date from
today
?
m
hi) yes
e
I think vanilla JS can do the trick
m
aaa
i think this normal for me)
Copy code
const today = new Date();
            const previousDay = new Date(today);
            previousDay.setDate(today.getDate() - 1); 
            log.debug('previousDay', previousDay);
b
you would only really want moment if you have to be precise enough to make the distinction between yesterday's date in pacific time vs yesterdays date in denmark time
m
I thought it was possible to get the date from a parameter execute or script session, but in general, calling new Date() will return the server date
my task is to call the script at the end of the day and get all the documents for the previous day