community icon indicating copy to clipboard operation
community copied to clipboard

toDate produces wrong date?

Open Steelhammer11 opened this issue 1 year ago • 1 comments

I used the following code, to get the timestamp (seconds since the unix epoch) for a certain UTC date:

{{- $creationTimeAsDateObject := toDate "2006-01-02T15:04:05Z" "2024-01-30T13:06:59Z" }} creationTimeAsDateObject: {{ $creationTimeAsDateObject }} {{- $timestamp := $creationTimeAsDateObject | unixEpoch }} timestamp: {{ $timestamp }}

It gave this output:

creationTimeAsDateObject: 2024-01-30 13:06:59 +0100 CET timestamp: 1706616419

When I checked the timestamp using https://www.epochconverter.com/ it showed that:

"2024-01-30T13:06:59Z" is 1706620019 "2024-01-30 13:06:59 +0100 CET" is 1706616419

I.e. the "toDate" generated a date that was one hour off compared to the UTC date being passed in. I.e. "2024-01-30T13:06:59Z" is NOT equal to "2024-01-30 13:06:59 +0100 CET"

I'm on Helm version: version.BuildInfo{Version:"v3.13.1", GitCommit:"3547a4b5bf5edb5478ce352e18858d8a552a4110", GitTreeState:"clean", GoVersion:"go1.20.8"}

Steelhammer11 avatar Feb 01 '24 12:02 Steelhammer11

Issues regarding Helm usage are best posted over on the helm software repo https://github.com/helm/helm. Please repost there. Thanks!

gjenkins8 avatar Apr 01 '24 15:04 gjenkins8