Countdown day

Hey guys, I was wondering on how to implement countdown days in my app. Let us assume I’m getting a task (for example 10) that is to be decremented with each passing day additionally, I’m getting the date and time also of the day the task is assigned from my backend.
So how can I implement it on my app??
From my point of view, I will assign the task to a variable and then decrement it on 24 hours basis of the assignment of the task.
Any help is appericiated.

Just calculate the value based on the current date/time and the original date/time. You could just calculate this using the Date object, or you could use a library like date-fns which makes it easier to calculate things with dates.

Thank you Josh for your help. :slight_smile:

One more thing I’m only getting the date on which the task has been assigned not the end date… For end date I will have to calculate from the no. of days given to finish the task. Will it be fine if done this way??