Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func BenchmarkParseAny(b *testing.B) {
b.ReportAllocs()
for i := 0; i < b.N; i++ {
for _, dateStr := range testDates {
ParseAny(dateStr)
ParseAny(dateStr, true)
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions dateparse/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func main() {
if len(flag.Args()) == 0 {
fmt.Println(`Must pass a time, and optional location:

./dateparse "2009-08-12T22:15:09.99Z"
./dateparse "2009-08-12T22:15:09.99Z"

./dateparse --timezone="America/Denver" "2017-07-19 03:21:51+00:00"
`)
Expand All @@ -31,7 +31,7 @@ func main() {

datestr = flag.Args()[0]

layout, err := dateparse.ParseFormat(datestr)
layout, err := dateparse.ParseFormat(datestr, true)
if err != nil {
fatal(err)
}
Expand Down Expand Up @@ -82,7 +82,7 @@ type parser func(datestr string, loc *time.Location, utc bool) string

func parseLocal(datestr string, loc *time.Location, utc bool) string {
time.Local = loc
t, err := dateparse.ParseLocal(datestr)
t, err := dateparse.ParseLocal(datestr, true)
if err != nil {
return err.Error()
}
Expand All @@ -93,7 +93,7 @@ func parseLocal(datestr string, loc *time.Location, utc bool) string {
}

func parseIn(datestr string, loc *time.Location, utc bool) string {
t, err := dateparse.ParseIn(datestr, loc)
t, err := dateparse.ParseIn(datestr, loc, true)
if err != nil {
return err.Error()
}
Expand All @@ -104,7 +104,7 @@ func parseIn(datestr string, loc *time.Location, utc bool) string {
}

func parseAny(datestr string, loc *time.Location, utc bool) string {
t, err := dateparse.ParseAny(datestr)
t, err := dateparse.ParseAny(datestr, true)
if err != nil {
return err.Error()
}
Expand All @@ -115,7 +115,7 @@ func parseAny(datestr string, loc *time.Location, utc bool) string {
}

func parseStrict(datestr string, loc *time.Location, utc bool) string {
t, err := dateparse.ParseStrict(datestr)
t, err := dateparse.ParseStrict(datestr, true)
if err != nil {
return err.Error()
}
Expand Down
2 changes: 1 addition & 1 deletion example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func main() {

table.AddHeaders("Input", "Parsed, and Output as %v")
for _, dateExample := range examples {
t, err := dateparse.ParseLocal(dateExample)
t, err := dateparse.ParseLocal(dateExample, true)
if err != nil {
panic(err.Error())
}
Expand Down
Loading