JQuery 比较 json 文件中的时间与当前时间

JQuery Comparing time in json file with current time

我有 json 那种格式的文件。在 Php 中,我创建了一个变量,它在每次被覆盖时以这种格式 date(h:i:s) 将时间写入文件。

{"Time":"11:01:57","Temperature":"21.00","Temperature2":"69.80","Humidity":"49.00"}

在客户端,我想使用 jquery 将文件中的时间与当前时间进行比较。例如,如果差异是 5 分钟,则执行某些操作。我不知道如何解决这个问题

假设:

  1. 只有时间很重要,日期不重要。
  2. 时区也是 一样。

    var startTime = Date.parse('11:01:57'); //Get today date and set time to this
    var now = new Date; //Get today date 
    var difference = (now - startTime); //Calculate difference in milliseconds
    

JSFiddle