There is such a task: there is a certain date, for example, 02/25/2017 20:32:57 and you need to determine whether 30 minutes have passed since the date was fixed, i.e. if now we have 21:00 then 30 minutes have passed, but if less, then we need to get the number of minutes and seconds that remained before 30 minutes have passed.
I managed to get the difference between the current date / time and the one given with the help of the library of momentjs:
var date = moment('2017-02-25T20:32:57.17282'); var timeDiff = moment.utc(moment().diff(date)).format("HH:mm:ss"); console.log(timeDiff); <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.js"></script> But now I do not understand how from 30 minutes I deduct the obtained value and get a string that contains the remaining number of minutes and seconds.
If someone faced a similar task or just knows how to solve, I will be grateful for the help. Thank.