To convert a timeago date string to an actual date object in TypeScript, you can use the Date
object constructor and pass in the time in milliseconds.
Here's an example function that takes a timeago date string as input and returns a Date
object:
index.ts197 chars7 lines
You can then use this function like so:
index.ts173 chars4 lines
This will output a Date
object that represents the actual date and time that the timeago string represents.
gistlibby LogSnag