ijt / go-anytime

Parse natural and standardized dates/times and ranges in Go without knowing the format in advance
MIT License
23 stars 2 forks source link

A Partition() func could be useful #26

Closed ijt closed 2 years ago

ijt commented 2 years ago

It could look something like this:

anytime.PartitionTimes("Let's meet Thursday or Friday if you're free") => []any{"Let's meet", time.Time{...}, "or", time.Time{...}, "if you're free"}

Alternatively there could be something based on callbacks:

anytime.PartitionTimesByFunc("Let's meet Thursday or Friday", func(s string) {/* non-time */}, func(t time.Time, s string) {/* time */})

That would be more type safe.