I see that there is a library that can return the current time in nanoseconds since epoch, but I don’t see anything that lets you do useful things with this value. Can I easily do any of the following things entirely in Motoko?
- Format the nanoseconds value as a locale-aware/readable string like
January 5th 2021, 4:49:30 pm
- Parse a string like
January 5th 2021, 4:49:30 pminto the nanoseconds since epoch
- Subtract two dates, returning the timespan between them (as years/months/hours/minutes etc)
Basically I’m looking for something like moment.js, but for Motoko. How do you work with Dates/Times in a convenient way in Motoko?