From db89f942c6e092ca8a05caa4806b8cd44dfd3577 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 28 Sep 2015 19:33:11 +0200 Subject: [PATCH] Improved error handling. --- .../javascripts/app/controllers/_ui_element/date.js.coffee | 4 ++-- .../app/controllers/_ui_element/datetime.js.coffee | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee index f082d2329..8444f45f4 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/date.js.coffee @@ -65,8 +65,8 @@ class App.UiElement.date item @format: (number) -> - if parseInt(number) < 10 - number = "0#{number}" + if number isnt '' && Number(number) < 10 + number = "0#{Number(number)}" number @setNewTime: (item, attribute, diff, reset = false, tolerant = false) -> diff --git a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee index e9c854988..ec3619cb2 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/datetime.js.coffee @@ -79,8 +79,8 @@ class App.UiElement.datetime item @format: (number) -> - if parseInt(number) < 10 - number = "0#{number}" + if number isnt '' && Number(number) < 10 + number = "0#{Number(number)}" number @setNewTime: (item, attribute, diff, reset = false, tolerant = false) ->