aboutsummaryrefslogtreecommitdiff
path: root/time.go
diff options
context:
space:
mode:
Diffstat (limited to 'time.go')
-rw-r--r--time.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/time.go b/time.go
index dc02480..3dee424 100644
--- a/time.go
+++ b/time.go
@@ -48,7 +48,13 @@ func (d *timeValue) Type() string {
return "time"
}
-func (d *timeValue) String() string { return d.Time.Format(time.RFC3339Nano) }
+func (d *timeValue) String() string {
+ if d.Time.IsZero() {
+ return ""
+ } else {
+ return d.Time.Format(time.RFC3339Nano)
+ }
+}
// GetTime return the time value of a flag with the given name
func (f *FlagSet) GetTime(name string) (time.Time, error) {