mirror of
https://github.com/frappe/air-datepicker.git
synced 2026-01-14 11:01:22 +08:00
add 'am/pm' to current time, change 'am/pm' sign to 'aa'
This commit is contained in:
parent
f5b208dbc5
commit
2fa2033611
30
dist/js/datepicker.js
vendored
30
dist/js/datepicker.js
vendored
@ -239,7 +239,10 @@ var Datepicker;
|
|||||||
this.loc.dateFormat = [this.loc.dateFormat, this.loc.timeFormat].join(this.opts.dateTimeSeparator);
|
this.loc.dateFormat = [this.loc.dateFormat, this.loc.timeFormat].join(this.opts.dateTimeSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.loc.timeFormat.match(this._getWordBoundaryRegExp('a'))) {
|
var boundary = this._getWordBoundaryRegExp;
|
||||||
|
if (this.loc.timeFormat.match(boundary('aa')) ||
|
||||||
|
this.loc.timeFormat.match(boundary('AA'))
|
||||||
|
) {
|
||||||
this.ampm = true;
|
this.ampm = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -356,8 +359,10 @@ var Datepicker;
|
|||||||
switch (true) {
|
switch (true) {
|
||||||
case /@/.test(result):
|
case /@/.test(result):
|
||||||
result = result.replace(/@/, date.getTime());
|
result = result.replace(/@/, date.getTime());
|
||||||
case /a/.test(result):
|
case /aa/.test(result):
|
||||||
result = result.replace(boundary('a'), dayPeriod);
|
result = result.replace(boundary('aa'), dayPeriod);
|
||||||
|
case /AA/.test(result):
|
||||||
|
result = result.replace(boundary('AA'), dayPeriod.toUpperCase());
|
||||||
case /dd/.test(result):
|
case /dd/.test(result):
|
||||||
result = result.replace(boundary('dd'), d.fullDate);
|
result = result.replace(boundary('dd'), d.fullDate);
|
||||||
case /d/.test(result):
|
case /d/.test(result):
|
||||||
@ -375,13 +380,13 @@ var Datepicker;
|
|||||||
case /M/.test(result):
|
case /M/.test(result):
|
||||||
result = result.replace(boundary('M'), locale.monthsShort[d.month]);
|
result = result.replace(boundary('M'), locale.monthsShort[d.month]);
|
||||||
case /ii/.test(result):
|
case /ii/.test(result):
|
||||||
result = result.replace(/\bii\b/, d.fullMinutes);
|
result = result.replace(boundary('ii'), d.fullMinutes);
|
||||||
case /i/.test(result):
|
case /i/.test(result):
|
||||||
result = result.replace(/\bi(?!>)\b/, d.minutes);
|
result = result.replace(boundary('i'), d.minutes);
|
||||||
case /hh/.test(result):
|
case /hh/.test(result):
|
||||||
result = result.replace(/\bhh\b/, fullHours);
|
result = result.replace(boundary('hh'), fullHours);
|
||||||
case /h/.test(result):
|
case /h/.test(result):
|
||||||
result = result.replace(/\bh\b/, hours);
|
result = result.replace(boundary('h'), hours);
|
||||||
case /yyyy/.test(result):
|
case /yyyy/.test(result):
|
||||||
result = result.replace(boundary('yyyy'), d.year);
|
result = result.replace(boundary('yyyy'), d.year);
|
||||||
case /yyyy1/.test(result):
|
case /yyyy1/.test(result):
|
||||||
@ -1899,6 +1904,11 @@ var Datepicker;
|
|||||||
this.$minutes = $('[name="minutes"]', this.$timepicker);
|
this.$minutes = $('[name="minutes"]', this.$timepicker);
|
||||||
this.$hoursText = $('.datepicker--time-current-hours', this.$timepicker);
|
this.$hoursText = $('.datepicker--time-current-hours', this.$timepicker);
|
||||||
this.$minutesText = $('.datepicker--time-current-minutes', this.$timepicker);
|
this.$minutesText = $('.datepicker--time-current-minutes', this.$timepicker);
|
||||||
|
|
||||||
|
if (this.d.ampm) {
|
||||||
|
this.$ampm = $('<span class="datepicker--time-current-ampm">')
|
||||||
|
.appendTo($('.datepicker--time-current', this.$timepicker));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_render: function () {
|
_render: function () {
|
||||||
@ -1910,7 +1920,11 @@ var Datepicker;
|
|||||||
m = datepicker.getLeadingZeroNum(this.minutes);
|
m = datepicker.getLeadingZeroNum(this.minutes);
|
||||||
|
|
||||||
this.$hoursText.html(h);
|
this.$hoursText.html(h);
|
||||||
this.$minutesText.html(m)
|
this.$minutesText.html(m);
|
||||||
|
|
||||||
|
if (this.d.ampm) {
|
||||||
|
this.$ampm.html(this.dayPeriod);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRanges: function () {
|
_updateRanges: function () {
|
||||||
|
|||||||
4
dist/js/datepicker.min.js
vendored
4
dist/js/datepicker.min.js
vendored
File diff suppressed because one or more lines are too long
@ -239,7 +239,10 @@ var Datepicker;
|
|||||||
this.loc.dateFormat = [this.loc.dateFormat, this.loc.timeFormat].join(this.opts.dateTimeSeparator);
|
this.loc.dateFormat = [this.loc.dateFormat, this.loc.timeFormat].join(this.opts.dateTimeSeparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.loc.timeFormat.match(this._getWordBoundaryRegExp('a'))) {
|
var boundary = this._getWordBoundaryRegExp;
|
||||||
|
if (this.loc.timeFormat.match(boundary('aa')) ||
|
||||||
|
this.loc.timeFormat.match(boundary('AA'))
|
||||||
|
) {
|
||||||
this.ampm = true;
|
this.ampm = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -356,8 +359,10 @@ var Datepicker;
|
|||||||
switch (true) {
|
switch (true) {
|
||||||
case /@/.test(result):
|
case /@/.test(result):
|
||||||
result = result.replace(/@/, date.getTime());
|
result = result.replace(/@/, date.getTime());
|
||||||
case /a/.test(result):
|
case /aa/.test(result):
|
||||||
result = result.replace(boundary('a'), dayPeriod);
|
result = result.replace(boundary('aa'), dayPeriod);
|
||||||
|
case /AA/.test(result):
|
||||||
|
result = result.replace(boundary('AA'), dayPeriod.toUpperCase());
|
||||||
case /dd/.test(result):
|
case /dd/.test(result):
|
||||||
result = result.replace(boundary('dd'), d.fullDate);
|
result = result.replace(boundary('dd'), d.fullDate);
|
||||||
case /d/.test(result):
|
case /d/.test(result):
|
||||||
@ -375,13 +380,13 @@ var Datepicker;
|
|||||||
case /M/.test(result):
|
case /M/.test(result):
|
||||||
result = result.replace(boundary('M'), locale.monthsShort[d.month]);
|
result = result.replace(boundary('M'), locale.monthsShort[d.month]);
|
||||||
case /ii/.test(result):
|
case /ii/.test(result):
|
||||||
result = result.replace(/\bii\b/, d.fullMinutes);
|
result = result.replace(boundary('ii'), d.fullMinutes);
|
||||||
case /i/.test(result):
|
case /i/.test(result):
|
||||||
result = result.replace(/\bi(?!>)\b/, d.minutes);
|
result = result.replace(boundary('i'), d.minutes);
|
||||||
case /hh/.test(result):
|
case /hh/.test(result):
|
||||||
result = result.replace(/\bhh\b/, fullHours);
|
result = result.replace(boundary('hh'), fullHours);
|
||||||
case /h/.test(result):
|
case /h/.test(result):
|
||||||
result = result.replace(/\bh\b/, hours);
|
result = result.replace(boundary('h'), hours);
|
||||||
case /yyyy/.test(result):
|
case /yyyy/.test(result):
|
||||||
result = result.replace(boundary('yyyy'), d.year);
|
result = result.replace(boundary('yyyy'), d.year);
|
||||||
case /yyyy1/.test(result):
|
case /yyyy1/.test(result):
|
||||||
|
|||||||
@ -112,6 +112,11 @@
|
|||||||
this.$minutes = $('[name="minutes"]', this.$timepicker);
|
this.$minutes = $('[name="minutes"]', this.$timepicker);
|
||||||
this.$hoursText = $('.datepicker--time-current-hours', this.$timepicker);
|
this.$hoursText = $('.datepicker--time-current-hours', this.$timepicker);
|
||||||
this.$minutesText = $('.datepicker--time-current-minutes', this.$timepicker);
|
this.$minutesText = $('.datepicker--time-current-minutes', this.$timepicker);
|
||||||
|
|
||||||
|
if (this.d.ampm) {
|
||||||
|
this.$ampm = $('<span class="datepicker--time-current-ampm">')
|
||||||
|
.appendTo($('.datepicker--time-current', this.$timepicker));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_render: function () {
|
_render: function () {
|
||||||
@ -123,7 +128,11 @@
|
|||||||
m = datepicker.getLeadingZeroNum(this.minutes);
|
m = datepicker.getLeadingZeroNum(this.minutes);
|
||||||
|
|
||||||
this.$hoursText.html(h);
|
this.$hoursText.html(h);
|
||||||
this.$minutesText.html(m)
|
this.$minutesText.html(m);
|
||||||
|
|
||||||
|
if (this.d.ampm) {
|
||||||
|
this.$ampm.html(this.dayPeriod);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateRanges: function () {
|
_updateRanges: function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user