add support of momentjs 2.0.0 in combodate, fix #121
This commit is contained in:
parent
299bc6d522
commit
e2ae81b687
@ -2,6 +2,12 @@ X-editable changelog
|
||||
=============================
|
||||
|
||||
|
||||
|
||||
Version 1.4.2 wip
|
||||
----------------------------
|
||||
[enh #121] add support of momentjs 2.0.0 in combodate (vitalets)
|
||||
|
||||
|
||||
Version 1.4.1 Jan 18, 2013
|
||||
----------------------------
|
||||
[enh #62] new option `selector` to work with delegated targets (vitalets)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Combodate - 1.0.1
|
||||
* Combodate - 1.0.2
|
||||
* Dropdown date and time picker.
|
||||
* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
|
||||
* Uses momentjs as datetime library http://momentjs.com.
|
||||
@ -102,9 +102,13 @@
|
||||
Initialize items of combos. Handles `firstItem` option
|
||||
*/
|
||||
initItems: function(key) {
|
||||
var values = [];
|
||||
var values = [],
|
||||
relTime;
|
||||
|
||||
if(this.options.firstItem === 'name') {
|
||||
var header = typeof moment.relativeTime[key] === 'function' ? moment.relativeTime[key](1, true, key, false) : moment.relativeTime[key];
|
||||
//need both to suuport moment ver < 2 and >= 2
|
||||
relTime = moment.relativeTime || moment.langData()._relativeTime;
|
||||
var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key];
|
||||
//take last entry (see momentjs lang files structure)
|
||||
header = header.split(' ').reverse()[0];
|
||||
values.push(['', header]);
|
||||
@ -150,9 +154,9 @@
|
||||
|
||||
for(i=0; i<=11; i++) {
|
||||
if(longNames) {
|
||||
name = moment.months[i];
|
||||
name = moment().month(i).format('MMMM');
|
||||
} else if(shortNames) {
|
||||
name = moment.monthsShort[i];
|
||||
name = moment().month(i).format('MMM');
|
||||
} else if(twoDigit) {
|
||||
name = this.leadZero(i+1);
|
||||
} else {
|
||||
|
6
src/inputs/combodate/lib/moment.min.1.7.2.js
Normal file
6
src/inputs/combodate/lib/moment.min.1.7.2.js
Normal file
File diff suppressed because one or more lines are too long
4
src/inputs/combodate/lib/moment.min.js
vendored
4
src/inputs/combodate/lib/moment.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user