Is the Lambdas in the debug stack really use the U...
# help
ö
Is the Lambdas in the debug stack really use the UTC? Because new Date() and/or new Date().toISOString() is in my local time
t
what do you mean lambdas in debug stack?
ö
The lambads that run in the development environment, i.e., through SST websockets
f
@Ömer Toraman those are actually “your” lambda functions, with code replaced (with stub code)
Oh I see what you mean! When u run
sst start
, the code is actually running locally, and uses ur local time.
ö
Yes
Thats what I tried to mean
f
Nice catch
t
new Date().toISOString() should always be returning utc time
it returns UTC time on my computer
ö
This is what it returned for `new Date(2022, 6, 1).toISOString()`:
Copy code
"2022-06-30T21:00:00.000Z"
f
@thdxr should we set the date locale to mimic the Lambda runtime when we spawn node process locally? Is that possible?
ö
And I live in Istanbul, Turkey, basically GMT + 3
t
what does this give you:
new Date(new Date().toUTCString()).toISOString()
oh nevermind I see what's happening, you're initializing the date yourself
ö
🤔
Is that a problem, i dont get it
👀
t
so you shouldn't rely on
new Date(x,x,x)
to always take UTC as an input - this might be true in Lambda currently but that can always change / other environments might work differently
you probably want
Date.UTC(2022, 2, 28)
ö
okay thanks