aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-07-11 17:34:07 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-07-11 17:34:07 +0200
commita1f214ee1ec0ed4b7659c3dbf94f66bc703a1908 (patch)
tree4cdeab606eac75c7b98913a6d22c132213efc219
parent{time => date}_to_percent. (diff)
downloadcalp-a1f214ee1ec0ed4b7659c3dbf94f66bc703a1908.tar.gz
calp-a1f214ee1ec0ed4b7659c3dbf94f66bc703a1908.tar.xz
Add decimal_time_to_date.
-rw-r--r--static/script.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/static/script.js b/static/script.js
index edef739a..e2fe5dc7 100644
--- a/static/script.js
+++ b/static/script.js
@@ -25,10 +25,16 @@ function decimal_time_to_string (time) {
if (hour < 10) {
hour = '0' + hour;
}
- var minute = String((time - Math.floor(time)) * 60).padStart(2, 0);
+ let minute = String((time - Math.floor(time)) * 60).padStart(2, 0);
return "" + hour + ":" + minute;
}
+function decimal_time_to_date (time) {
+ let hour = Math.floor(time);
+ let minute = (time - hour) * 60;
+ return new Date(0,0,0,hour,minute,0);
+}
+
let gensym_counter = 0;
function gensym (prefix) {
gensym_counter++;