eggheadio-github / stack-overflow-copy-paste

Utility functions copy/pasted (and modified slightly) from Stack Overflow
441 stars 606 forks source link

timeSince function to format a JavaScript Date as a string stating the time elapsed e.g "4 mins ago" #215

Closed sumdook closed 5 years ago

sumdook commented 5 years ago

Hi Kent!

I found your Youtube live stream "Contributing to Open Source on GitHub for beginners". It was very inspiring and gave me a whole new perspective.

I'd like to add a feature to format JS Date to a string based on how much time has elapsed, e.g "5 hours ago" like Instagram shows time. It's inspired by this answer on StackOverflow.

https://stackoverflow.com/a/3177838/8301717

kentcdodds commented 5 years ago

Sounds great @soumikcv!

kentcdodds commented 5 years ago

Great job!