From 82cf2b33cf1489f9ecd58df1d44fa4225b4ed867 Mon Sep 17 00:00:00 2001 From: Alishan Ladhani Date: Fri, 12 May 2017 00:10:49 -0400 Subject: [PATCH] Fix bug with DateJS Fix DateJS bug where sometimes >12 minutes/hours/days converts into the wrong timestamp. Removing the space makes DateJS work properly. --- interfaces/Glitter/templates/static/javascripts/glitter.main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/interfaces/Glitter/templates/static/javascripts/glitter.main.js b/interfaces/Glitter/templates/static/javascripts/glitter.main.js index c019d15..4794727 100644 --- a/interfaces/Glitter/templates/static/javascripts/glitter.main.js +++ b/interfaces/Glitter/templates/static/javascripts/glitter.main.js @@ -471,6 +471,12 @@ function ViewModel() { return; } + // Fix DateJS bug where sometimes >12 minutes/hours/days (ex. "13 hours") converts into the wrong timestamp + // Removing the space makes DateJS work properly + newValue = newValue.replace(/\s*hour|\s*minute|\s*min|\s*day/g, function(match) { + return match.trim() + }); + // Parse var pauseParsed = Date.parse(newValue);