remove redudant time func

Signed-off-by: Abhilash Gnan <abhilashgnan@gmail.com>
pull/7024/head
Abhilash Gnan 5 years ago
parent b17cf19a2e
commit 3ca46f3b23

@ -29,7 +29,6 @@ import (
"helm.sh/helm/v3/pkg/action" "helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/cli/output" "helm.sh/helm/v3/pkg/cli/output"
"helm.sh/helm/v3/pkg/release" "helm.sh/helm/v3/pkg/release"
helmtime "helm.sh/helm/v3/pkg/time"
) )
var listHelp = ` var listHelp = `
@ -165,7 +164,7 @@ func newReleaseListWriter(releases []*release.Release, timeFormat string) *relea
t := "-" t := "-"
if tspb := r.Info.LastDeployed; !tspb.IsZero() { if tspb := r.Info.LastDeployed; !tspb.IsZero() {
if timeFormat != "" { if timeFormat != "" {
t = helmtime.Format(tspb, timeFormat) t = tspb.Format(timeFormat)
} else { } else {
t = tspb.String() t = tspb.String()
} }

@ -89,8 +89,3 @@ func (t Time) Round(d time.Duration) Time { return Time{Time: t.Time.Round(d)
func (t Time) Sub(u Time) time.Duration { return t.Time.Sub(u.Time) } func (t Time) Sub(u Time) time.Duration { return t.Time.Sub(u.Time) }
func (t Time) Truncate(d time.Duration) Time { return Time{Time: t.Time.Truncate(d)} } func (t Time) Truncate(d time.Duration) Time { return Time{Time: t.Time.Truncate(d)} }
func (t Time) UTC() Time { return Time{Time: t.Time.UTC()} } func (t Time) UTC() Time { return Time{Time: t.Time.UTC()} }
// Format formats time in custom output format
func Format(t Time, format string) string {
return t.Format(format)
}

@ -81,19 +81,3 @@ func TestZeroValueUnmarshal(t *testing.T) {
t.Errorf("expected time to be equal to zero value, got %v", myTime) t.Errorf("expected time to be equal to zero value, got %v", myTime)
} }
} }
func TestFormat(t *testing.T) {
when := Date(2009, 11, 17, 20, 34, 58, 651387237, time.UTC)
expected := "2009-11-17 20:34:58 +0000 UTC"
got := Format(when, "2006-01-02 15:04:05 -0700 MST")
if expected != got {
t.Errorf("expected %s, got %s", expected, got)
}
expected = "2009-11-17 20:34 +0000 UTC"
got = Format(when, "2006-01-02 15:04 -0700 MST")
if expected != got {
t.Errorf("expected %s, got %s", expected, got)
}
}

Loading…
Cancel
Save