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

`ReplaceTimesByFunc()` and `ReplaceRangesByFunc()` #14

Closed ijt closed 2 years ago

ijt commented 2 years ago

It would be useful to have functions that replace the times or time ranges within a string, typically to put them into a standardized format or just to label them. For example,

ReplaceTimesByFunc("Let's meet on Tuesday at 11am UTC", time.Now(), func(t time.Time) string { return t.String() })

would return something like

"Let's meet 2022-10-25 12:00:00 +0000 UTC"