Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time utility #163

Closed
frsechet opened this issue Jan 4, 2021 · 1 comment · Fixed by #263
Closed

Time utility #163

frsechet opened this issue Jan 4, 2021 · 1 comment · Fixed by #263
Labels
enhancement New feature or request

Comments

@frsechet
Copy link
Member

frsechet commented Jan 4, 2021

Is your feature request related to a problem? Please describe.
getting the current time or converting timestamps to various formats requires using an external function, which is cumbersome, requires external code in a different programming language, requires an external Fn runtime, and adds delays. It would be useful to add some way to get timestamps, convert those in various formats, get timediffs, and optionally change timezone...

ESPECIALLY useful for calendar-types of chatbot (book an event on date X)

Describe the solution you'd like
Some inspiration:

  • JS: built-in Date, date-fn, momentjs...
  • rust: chrono, chrono-tz
    etc.

Describe alternatives you've considered
Fn("getTime", ...)

@frsechet frsechet added the enhancement New feature or request label Jan 4, 2021
@frsechet frsechet added this to the v1.5.0 milestone Feb 10, 2021
@frsechet frsechet removed this from the v1.5.0 milestone Mar 18, 2021
@frsechet
Copy link
Member Author

For reference:

Time() => initialize Time obj (UTC)
Time().at(2019, 03, 28, 12, 53, 20, 123) => initialize a Time obj on 2019-03-28 at 12h53m20s.123
Time()... .unix() => Time as unix timestamp (in milliseconds)
Time()... .format() => ISO-formatted string representing the Time obj
Time()... .format("%h%d etc") => custom-formatted string representing the Time obj (see https://docs.rs/chrono/0.4.19/chrono/format/strftime/index.html)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant