DEV Community

Discussion on: Converting date to relative time format in TypeScript

Collapse
 
rammina profile image
Rammina

Thank you for sharing this information!

How about using libraries like date-fns? Wouldn't that make things simpler?
date-fns.org/
It also has type definition files for Typescript.

Collapse
 
shubhamkumar10 profile image
Shubham Kumar

Yes we can definitely use libraries, but the idea here was to write your own util function to keep the bundle size low. Adding a whole lib just to use a single function didn't make sense to me.

Collapse
 
rammina profile image
Rammina

True, I suppose if it's only a single functionality, a library would be overkill. Thank you!