2
0
mirror of https://github.com/araddon/dateparse.git synced 2026-09-02 16:54:34 +08:00

Doc updates

This commit is contained in:
Aaron Raddon
2017-07-21 09:55:49 -07:00
parent 809ce8e70f
commit 209c162b6b
2 changed files with 22 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ var (
)
func main() {
flag.StringVar(&timezone, "timezone", "UTC", "Timezone aka `America/Los_Angeles` formatted time-zone")
flag.StringVar(&timezone, "timezone", "", "Timezone aka `America/Los_Angeles` formatted time-zone")
flag.Parse()
if len(flag.Args()) == 0 {
@@ -26,11 +26,11 @@ func main() {
table := termtables.CreateTable()
table.AddHeaders("Input", "Timezone", "Parsed, and Output as %v")
table.AddHeaders("Input", "Zone Source", "Timezone", "Parsed, and Output as %v")
zonename, _ := time.Now().In(time.Local).Zone()
table.AddRow(datestr, fmt.Sprintf("%v", zonename), fmt.Sprintf("%v", dateparse.MustParse(datestr)))
table.AddRow(datestr, "Local Default", fmt.Sprintf("%v", zonename), fmt.Sprintf("%v", dateparse.MustParse(datestr)))
if timezone != "" {
// NOTE: This is very, very important to understand
@@ -40,11 +40,11 @@ func main() {
panic(err.Error())
}
time.Local = loc
table.AddRow(datestr, fmt.Sprintf("%v", timezone), fmt.Sprintf("%v", dateparse.MustParse(datestr)))
table.AddRow(datestr, "timezone arg", fmt.Sprintf("%v", timezone), fmt.Sprintf("%v", dateparse.MustParse(datestr)))
}
time.Local = time.UTC
table.AddRow(datestr, "UTC", fmt.Sprintf("%v", dateparse.MustParse(datestr)))
table.AddRow(datestr, "UTC", "UTC", fmt.Sprintf("%v", dateparse.MustParse(datestr)))
fmt.Println(table.Render())
}