Browse Source

gantt chart fixes

version-14
Rushabh Mehta 13 years ago
parent
commit
2870a97720
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      js/legacy/utils/datetime.js

+ 5
- 3
js/legacy/utils/datetime.js View File

@@ -41,6 +41,7 @@ function int_to_str(i, len) {
wn.datetime = { wn.datetime = {
str_to_obj: function(d) { str_to_obj: function(d) {
if(typeof d=="object") return d;
if(!d) return new Date(); if(!d) return new Date();
var tm = [null, null]; var tm = [null, null];
if(d.search(' ')!=-1) { if(d.search(' ')!=-1) {
@@ -57,6 +58,7 @@ wn.datetime = {
}, },


obj_to_str: function(d) { obj_to_str: function(d) {
if(typeof d=='string') return d;
return d.getFullYear() + '-' + int_to_str(d.getMonth()+1,2) + '-' + int_to_str(d.getDate(),2); return d.getFullYear() + '-' + int_to_str(d.getMonth()+1,2) + '-' + int_to_str(d.getDate(),2);
}, },
@@ -76,9 +78,9 @@ wn.datetime = {
}, },
add_days: function(d, days) { add_days: function(d, days) {
dt = dateutil.str_to_obj(d)
dt.setTime(dt.getTime()+(days*24*60*60*1000));
return dateutil.obj_to_str(dt);
var dt = dateutil.str_to_obj(d);
var new_dt = new Date(dt.getTime()+(days*24*60*60*1000));
return dateutil.obj_to_str(new_dt);
}, },
add_months: function(d, months) { add_months: function(d, months) {


Loading…
Cancel
Save