frontello-ui-datepicker
Advanced tools
Comparing version 3.0.5 to 3.0.6
@@ -215,33 +215,24 @@ "use strict"; | ||
this._renderDate(); | ||
return this; | ||
return this._renderDate(); | ||
} | ||
setPrevYear() | ||
moveYear(nbYear) | ||
{ | ||
if (this.config.debug) { | ||
console.log('Set month : ' + month); | ||
if (nbYear == 0) { | ||
return this; | ||
} | ||
this.setYear(this.getYear() - 1); | ||
this._renderDate(); | ||
return this; | ||
return this.setYear(this.getYear() + nbYear); | ||
} | ||
setNextYear() | ||
upYear() | ||
{ | ||
if (this.config.debug) { | ||
console.log('Set month : ' + month); | ||
} | ||
this.setYear(this.getYear() + 1); | ||
this._renderDate(); | ||
return this; | ||
return this.moveYear(-1); | ||
} | ||
downYear() | ||
{ | ||
return this.moveYear(1); | ||
} | ||
getYear() | ||
@@ -254,11 +245,7 @@ { | ||
{ | ||
if (month > 12) { | ||
month = month%12; | ||
if (month < 1 || month > 12) { | ||
console.log('Invalid month : ' + month); | ||
return this; | ||
} | ||
if (month < 0) { | ||
if (month < 12) { | ||
month = month%12; | ||
} | ||
month = (12+month); | ||
} | ||
@@ -271,23 +258,37 @@ if (this.config.debug) { | ||
this._renderDate(); | ||
return this; | ||
return this._renderDate(); | ||
} | ||
upMonth() | ||
moveMonth(nbMonth) | ||
{ | ||
this.setMonth(this.getMonth() + 1); | ||
if (nbMonth == 0) { | ||
return this; | ||
} | ||
this._renderDate(); | ||
let month = this.getMonth() + nbMonth; | ||
return this; | ||
this.moveYear(Math.ceil((month-12)/12)); | ||
if (month > 12) { | ||
month = month%12; | ||
} | ||
if (month <= 0) { | ||
if (month < 12) { | ||
month = month%12; | ||
} | ||
month = (12+month); | ||
} | ||
return this.setMonth(month); | ||
} | ||
upMonth() | ||
{ | ||
return this.moveMonth(1); | ||
} | ||
downMonth() | ||
{ | ||
this.setMonth(this.getMonth() - 1); | ||
this._renderDate(); | ||
return this; | ||
return this.moveMonth(-1); | ||
} | ||
@@ -313,7 +314,24 @@ | ||
this._renderDate(); | ||
return this._renderDate(); | ||
} | ||
moveDay(nbDay) | ||
{ | ||
if (nbDay == 0) { | ||
return this; | ||
} | ||
return this; | ||
return this.setDate(this.getDay() + nbDay); | ||
} | ||
upDay() | ||
{ | ||
return this.moveDay(1); | ||
} | ||
downDay() | ||
{ | ||
return this.moveDay(-1); | ||
} | ||
getDay() | ||
@@ -334,5 +352,3 @@ { | ||
this._renderDate(); | ||
return this; | ||
return this._renderDate(); | ||
} | ||
@@ -372,2 +388,25 @@ | ||
{ | ||
if (hour < 0 || hour > 23) { | ||
console.log('Invalid hour : ' + hour); | ||
return this; | ||
} | ||
if (this.config.debug) { | ||
console.log('Set hour : ' + hour); | ||
} | ||
this.date.setHours(hour); | ||
return this._renderDate(); | ||
} | ||
moveHour(nbHour) | ||
{ | ||
if (nbHour == 0) { | ||
return this; | ||
} | ||
let hour = this.getHour() + nbHour; | ||
if (hour > 23) { | ||
@@ -383,11 +422,3 @@ hour = hour%24; | ||
if (this.config.debug) { | ||
console.log('Set hour : ' + hour); | ||
} | ||
this.date.setHours(hour); | ||
this._renderDate(); | ||
return this; | ||
return this.setHour(hour); | ||
} | ||
@@ -397,7 +428,3 @@ | ||
{ | ||
this.setHour(this.getHour() + 1); | ||
this._renderDate(); | ||
return this; | ||
return this.moveHour(1); | ||
} | ||
@@ -407,7 +434,3 @@ | ||
{ | ||
this.setHour(this.getHour() - 1); | ||
this._renderDate(); | ||
return this; | ||
return this.moveHour(-1); | ||
} | ||
@@ -422,2 +445,25 @@ | ||
{ | ||
if (minute < 0 || minute > 59) { | ||
console.log('Invalid hour : ' + minute); | ||
return this; | ||
} | ||
if (this.config.debug) { | ||
console.log('Set minute : ' + minute); | ||
} | ||
this.date.setMinutes(minute); | ||
return this._renderDate(); | ||
} | ||
moveMinute(nbMinute) | ||
{ | ||
if (nbMinute == 0) { | ||
return this; | ||
} | ||
let minute = this.getMinute() + nbMinute; | ||
if (this.config.minuteStep) { | ||
@@ -433,2 +479,3 @@ let modulo = minute % this.config.minuteStep; | ||
} | ||
if (minute < 0) { | ||
@@ -441,11 +488,3 @@ if (minute < 60) { | ||
if (this.config.debug) { | ||
console.log('Set minute : ' + minute); | ||
} | ||
this.date.setMinutes(minute); | ||
this._renderDate(); | ||
return this; | ||
return this.setMinute(minute); | ||
} | ||
@@ -455,9 +494,3 @@ | ||
{ | ||
let minute = | ||
this.setMinute(this.getMinute() + this.config.minuteStep); | ||
this._renderDate(); | ||
return this; | ||
return this.moveMinute(this.config.minuteStep ?? 1); | ||
} | ||
@@ -467,7 +500,3 @@ | ||
{ | ||
this.setMinute(this.getMinute() - this.config.minuteStep); | ||
this._renderDate(); | ||
return this; | ||
return this.moveMinute(-(this.config.minuteStep ?? 1)); | ||
} | ||
@@ -512,2 +541,4 @@ | ||
} | ||
return this; | ||
} | ||
@@ -873,3 +904,3 @@ | ||
yearPrev.addEventListener('click', (e) => { | ||
this.setPrevYear(); | ||
this.upYear(); | ||
}); | ||
@@ -893,3 +924,3 @@ this.yearNav.append(yearPrev); | ||
yearNext.addEventListener('click', (e) => { | ||
this.setNextYear(); | ||
this.downYear(); | ||
}); | ||
@@ -896,0 +927,0 @@ this.yearNav.append(yearNext); |
{ | ||
"name": "frontello-ui-datepicker", | ||
"version": "3.0.5", | ||
"version": "3.0.6", | ||
"description": "Efficient vanilla datepicker", | ||
@@ -5,0 +5,0 @@ "main": "datepicker.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33211
1050