mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-02-07 01:54:16 +01:00
Format BDAY according to 'datepickerFormatDate'
This commit is contained in:
parent
c155faff21
commit
972babf63d
@ -480,6 +480,10 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
? $.param(params.value)
|
? $.param(params.value)
|
||||||
: encodeURIComponent(params.value);
|
: encodeURIComponent(params.value);
|
||||||
}
|
}
|
||||||
|
if(!args) {
|
||||||
|
console.log('No arguments. returning');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
console.log('args', args);
|
console.log('args', args);
|
||||||
var self = this;
|
var self = this;
|
||||||
this.setAsSaving(obj, true);
|
this.setAsSaving(obj, true);
|
||||||
@ -548,7 +552,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
break;
|
break;
|
||||||
case 'BDAY':
|
case 'BDAY':
|
||||||
// reverse order again.
|
// reverse order again.
|
||||||
value = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate('dd-mm-yy', value));
|
value = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(datepickerFormatDate, value));
|
||||||
self.data[element][0] = {
|
self.data[element][0] = {
|
||||||
name: element,
|
name: element,
|
||||||
value: value,
|
value: value,
|
||||||
@ -796,6 +800,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
};
|
};
|
||||||
|
|
||||||
Contact.prototype.argumentsFor = function(obj) {
|
Contact.prototype.argumentsFor = function(obj) {
|
||||||
|
console.log('Contact.argumentsFor', $(obj));
|
||||||
var args = {};
|
var args = {};
|
||||||
var ptype = this.propertyTypeFor(obj);
|
var ptype = this.propertyTypeFor(obj);
|
||||||
args['name'] = ptype;
|
args['name'] = ptype;
|
||||||
@ -823,7 +828,23 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
//args['value'].push($(e).val());
|
//args['value'].push($(e).val());
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
args['value'] = $elements.val();
|
var value = $elements.val();
|
||||||
|
switch(args['name']) {
|
||||||
|
case 'BDAY':
|
||||||
|
try {
|
||||||
|
args['value'] = $.datepicker.formatDate('yy-mm-dd', $.datepicker.parseDate(datepickerFormatDate, value));
|
||||||
|
} catch(e) {
|
||||||
|
$(document).trigger(
|
||||||
|
'status.contacts.error',
|
||||||
|
{message:t('contacts', 'Error parsing date: {date}', {date:value})}
|
||||||
|
);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
args['value'] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
args['parameters'] = this.parametersFor(obj);
|
args['parameters'] = this.parametersFor(obj);
|
||||||
@ -1087,7 +1108,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
title: this.getPreferredValue('TITLE', ''),
|
title: this.getPreferredValue('TITLE', ''),
|
||||||
org: this.getPreferredValue('ORG', []).clean('').join(', '), // TODO Add parts if more than one.
|
org: this.getPreferredValue('ORG', []).clean('').join(', '), // TODO Add parts if more than one.
|
||||||
bday: this.getPreferredValue('BDAY', '').length >= 10
|
bday: this.getPreferredValue('BDAY', '').length >= 10
|
||||||
? $.datepicker.formatDate('dd-mm-yy',
|
? $.datepicker.formatDate(datepickerFormatDate,
|
||||||
$.datepicker.parseDate('yy-mm-dd',
|
$.datepicker.parseDate('yy-mm-dd',
|
||||||
this.getPreferredValue('BDAY', '').substring(0, 10)))
|
this.getPreferredValue('BDAY', '').substring(0, 10)))
|
||||||
: '',
|
: '',
|
||||||
@ -1182,6 +1203,7 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
if(event.keyCode === 13 && $(this).is('input')) {
|
if(event.keyCode === 13 && $(this).is('input')) {
|
||||||
$(this).trigger('change');
|
$(this).trigger('change');
|
||||||
// Prevent a second save on blur.
|
// Prevent a second save on blur.
|
||||||
|
this.previousValue = this.defaultValue || '';
|
||||||
this.defaultValue = this.value;
|
this.defaultValue = this.value;
|
||||||
return false;
|
return false;
|
||||||
} else if(event.keyCode === 27) {
|
} else if(event.keyCode === 27) {
|
||||||
@ -1200,10 +1222,12 @@ OC.Contacts = OC.Contacts || {};
|
|||||||
self.saveProperty({obj:event.target});
|
self.saveProperty({obj:event.target});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$fullelem.find('[data-element="bday"]')
|
var $bdayinput = this.$fullelem.find('[data-element="bday"]').find('input');
|
||||||
.find('input').datepicker({
|
$bdayinput.datepicker({
|
||||||
dateFormat : 'dd-mm-yy'
|
dateFormat : datepickerFormatDate
|
||||||
});
|
});
|
||||||
|
$bdayinput.attr('placeholder', $.datepicker.formatDate(datepickerFormatDate, new Date()));
|
||||||
|
|
||||||
this.$fullelem.find('.favorite').on('click', function () {
|
this.$fullelem.find('.favorite').on('click', function () {
|
||||||
var state = $(this).hasClass('active');
|
var state = $(this).hasClass('active');
|
||||||
if(!self.data) {
|
if(!self.data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user