summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-10-29 12:12:26 +0200
committertomsmeding <tom.smeding@gmail.com>2016-10-29 12:12:26 +0200
commit454c7ae8b7d4c683ef19df46d83a35a1f18b48fd (patch)
tree937fb8ec1e6d998c2b15a71a8a295957df60d802 /modules
parentef6d903de0ec107770ccbc8efb8ee447d6cad840 (diff)
todo: Better date reporting
Diffstat (limited to 'modules')
-rw-r--r--modules/todo/todo.html14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/todo/todo.html b/modules/todo/todo.html
index 309fb18..b196682 100644
--- a/modules/todo/todo.html
+++ b/modules/todo/todo.html
@@ -41,13 +41,20 @@ function pad(s,n,c){
}
function beginOfDay(date){
- return new Date(date.getTime()-date.getHours()*3600*1000-date.getMinutes()*60*1000-date.getSeconds()*1000-date.getMilliseconds());
+ var d=new Date(date.getTime());
+ d.setHours(0);
+ d.setMinutes(0);
+ d.setSeconds(0);
+ d.setMilliseconds(0);
+ return d;
}
function fancytime(timeS){
return pad(timeS.hour,2,"0")+":"+pad(timeS.min,2,"0")+(timeS.sec==0?"":":"+pad(timeS.sec,2,"0"));
}
+var weekdays=["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
+
function fancydate(date){
var now=new Date();
var nowS=datesplit(new Date());
@@ -62,12 +69,12 @@ function fancydate(date){
}
var diffweeks=~~(diffdays/7);
if(diffweeks>0){
- return "In "+diffweeks+" week"+(diffweeks==1?"":"s")+", "+diffdays%7+" day"+(diffdays%7==1?"":"s");
+ return weekdays[(date.getDay()+6)%7]+" in "+diffweeks+" week"+(diffweeks==1?"":"s");
}
if(diffdays==1){
return "Tomorrow, "+fancytime(dateS);
}
- return "In "+diffdays+" day"+(diffdays==1?"":"s")+", "+fancytime(dateS);
+ return weekdays[(date.getDay()+6)%7]+", "+fancytime(dateS);
}
function tablerowfor(task){
@@ -210,7 +217,6 @@ body{
font-size:12px;
font-style:italic;
display:inline-block;
- cursor:help;
}
.subdate{
color:#ccc;