https://serverless-stack.com/ logo
#help
Title
# help
ö

Ömer Toraman

05/06/2022, 3:20 PM
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

thdxr

05/06/2022, 3:45 PM
what do you mean lambdas in debug stack?
ö

Ömer Toraman

05/06/2022, 3:49 PM
The lambads that run in the development environment, i.e., through SST websockets
f

Frank

05/06/2022, 4:11 PM
@Ö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.
ö

Ömer Toraman

05/06/2022, 4:13 PM
Yes
Thats what I tried to mean
f

Frank

05/06/2022, 4:13 PM
Nice catch
t

thdxr

05/06/2022, 4:14 PM
new Date().toISOString() should always be returning utc time
it returns UTC time on my computer
ö

Ömer Toraman

05/06/2022, 4:15 PM
This is what it returned for `new Date(2022, 6, 1).toISOString()`:
Copy code
"2022-06-30T21:00:00.000Z"
f

Frank

05/06/2022, 4:15 PM
@thdxr should we set the date locale to mimic the Lambda runtime when we spawn node process locally? Is that possible?
ö

Ömer Toraman

05/06/2022, 4:15 PM
And I live in Istanbul, Turkey, basically GMT + 3
t

thdxr

05/06/2022, 4:18 PM
what does this give you:
new Date(new Date().toUTCString()).toISOString()
oh nevermind I see what's happening, you're initializing the date yourself
ö

Ömer Toraman

05/06/2022, 4:19 PM
🤔
Is that a problem, i dont get it
👀
t

thdxr

05/11/2022, 2:42 PM
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)
ö

Ömer Toraman

05/11/2022, 10:17 PM
okay thanks
4 Views