Skip to content

toDate produces wrong date? #334

@Steelhammer11

Description

@Steelhammer11

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"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions