1
0
Fork 0
forked from 0x2620/oxjs

rather use ''.slice than ''.substr

This commit is contained in:
rolux 2012-05-24 11:47:33 +02:00
commit 1608664bb6
20 changed files with 69 additions and 71 deletions

View file

@ -26,7 +26,7 @@ Ox.getDateInWeek = function(date, weekday, utc) {
var sourceWeekday = Ox.getISODay(date, utc),
targetWeekday = Ox.isNumber(weekday) ? weekday
: Ox.indexOf(Ox.WEEKDAYS, function(v) {
return v.substr(0, 3) == weekday.substr(0, 3);
return v.slice(0, 3) == weekday.slice(0, 3);
}) + 1;
return Ox.setDate(date, Ox.getDate(date, utc) - sourceWeekday + targetWeekday, utc);
}
@ -72,7 +72,7 @@ Ox.getDaysInMonth = function(year, month) {
year = Ox.makeYear(year);
month = Ox.isNumber(month) ? month
: Ox.indexOf(Ox.MONTHS, function(v) {
return v.substr(0, 3) == month.substr(0, 3);
return v.slice(0, 3) == month.slice(0, 3);
}) + 1;
return new Date(year, month, 0).getDate();
}