Currently I'm working with an API which returns me a date(created_at) in this format:
Y-m-dTH-m-sZ.
Actually I can't find out how can I calculate a difference between this format of a date and a current date that I can receive from new Date()
.
And the difference should be in the format like this for ex.:
2 hours ago, 10 days ago.
Is it a built in function in JS? Or how can I make this calculation and get an answer in the appropriate format?
Please help.