This commit is contained in:
Adam Shaw
2009-11-22 16:21:13 -08:00
parent d1bc5dc529
commit 23d99323cc
16 changed files with 247 additions and 156 deletions
+17
View File
@@ -47,6 +47,7 @@ function addDays(d, n, keepTime) { // deals with daylight savings
}
return d;
}
fc.addDays = addDays;
function addMinutes(d, n) {
d.setMinutes(d.getMinutes() + n);
@@ -68,6 +69,22 @@ function cloneDate(d, dontKeepTime) {
return new Date(+d);
}
function zeroDate() { // returns a Date with time 00:00:00 and dateOfMonth=1
var i=0, d;
do {
d = new Date(1970, i++, 1);
} while (d.getHours() != 0);
return d;
}
function skipWeekend(date, inc, excl) {
inc = inc || 1;
while (date.getDay()==0 || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
addDays(date, inc);
}
return date;
}
/* Date Parsing