I want to display remaining hours, minutes and seconds to a specific preset time (01:00 PM) from the current time with help of moment js. I am using the following code,
var n = new Date();
var end = new Date(n.getFullYear(), n.getMonth(), n.getDate(), 13, 0, 0, 0);
var a = moment(end);
var b = moment(n);
var eta = a.subtract(b).toDate().toLocaleTimeString();
It works fine until the remaining hours is greater than zero. For example whenever the time reaches 12:10 PM it should display 0 Hours and 40 Minutes remaining, instead show 12 hours and 40 minutes remaining.
How to get this fixed?