You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The checker interface doesn't allow storing and retrieving durations, which are often very useful especially for webapplications. Of course one could use an int to store durations, but if things like "m","h","days",... are interpreted it is way easier for the user to configure durations.
The text was updated successfully, but these errors were encountered:
Processing dates (and by extension times) is a bit of a complicated topic, and as far as I know there isn't really a standard way of representing them in a CLI.
I don't really see much of an advantage to adding them in as first class citizens compared to using the normal string interface, and then getting a time object via time.Parse. Something like the following would work:
You'll pass an input `./cli --date="2018-03-18"
You get it as a string: date := conf.String("date", "2012-12-21", "a date... for something") (and then call conf.Parse() somewhere as usual).
You parse that date into an actual time (t, _ = time.Parse("2006-01-02", date))
???
Profit!
I'm going to go ahead and close this issue, but feel free to re-open it if If you want to keep the discussion going :)
edit: and if you specifically want durations, the time package has you covered on that too I think. The parse function is a magical thing.
The checker interface doesn't allow storing and retrieving durations, which are often very useful especially for webapplications. Of course one could use an int to store durations, but if things like "m","h","days",... are interpreted it is way easier for the user to configure durations.
The text was updated successfully, but these errors were encountered: