Inconsistent behaviour of toDate and mustToDate depending on client system time zone
I am using Helm and found the following problems with the toDate function:
In my understanding the following template snippet should output the same independent of the client system time zone, but actually behaves very inconsistent when changing the client system time zone:
Template:
{{- $dateCET := toDate "2006-01-02 15:04 MST" (print "2006-01-02 03:00 CET") }}
{{- $dateCET }}
{{- dateInZone "2006-01-02 15:04 MST" $dateCET "UTC" -}}
Output in different client system time zones:
Client system in GMT: 2006-01-02 03:00:00 +0000 CET 2006-01-02 03:00 UTC
Client system in CET: 2006-01-02 03:00:00 +0100 CET 2006-01-02 02:00 UTC
Client system in CEST: 2006-01-02 03:00:00 +0100 CET 2006-01-02 02:00 UTC
Client system in EDT: 2006-01-02 03:00:00 +0000 CET 2006-01-02 03:00 UTC
Client system in EET: 2006-01-02 04:00:00 +0200 EET 2006-01-02 02:00 UTC
Output of helm version:
version.BuildInfo{Version:"v3.7.1", GitCommit:"1d11fcb5d3f3bf00dbe6fe31b8412839a96b3dc4", GitTreeState:"clean", GoVersion:"go1.17.2"}
Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.0", GitCommit:"cb303e613a121a29364f75cc67d3d580833a7479", GitTreeState:"clean", BuildDate:"2021-04-08T21:16:14Z", GoVersion:"go1.16.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.7-eks-d88609", GitCommit:"d886092805d5cc3a47ed5cf0c43de38ce442dfcb", GitTreeState:"clean", BuildDate:"2021-07-31T00:29:12Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}
Side note: I already opened an issue in the Helm repo, but the redirected me here (https://github.com/helm/helm/issues/10303).