mirror of
https://git.proxmox.com/git/proxmox-widget-toolkit
synced 2025-07-17 20:50:03 +00:00

compared result with `diffoscope`, saw now difference Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
35 lines
634 B
JavaScript
35 lines
634 B
JavaScript
// treats 0 as "never expires"
|
|
Ext.define('Proxmox.form.field.ExpireDate', {
|
|
extend: 'Ext.form.field.Date',
|
|
alias: ['widget.pmxExpireDate'],
|
|
|
|
name: 'expire',
|
|
fieldLabel: gettext('Expire'),
|
|
emptyText: 'never',
|
|
format: 'Y-m-d',
|
|
submitFormat: 'U',
|
|
|
|
getSubmitValue: function() {
|
|
let me = this;
|
|
|
|
let value = me.callParent();
|
|
if (!value) value = 0;
|
|
|
|
return value;
|
|
},
|
|
|
|
setValue: function(value) {
|
|
let me = this;
|
|
|
|
if (Ext.isDefined(value)) {
|
|
if (!value) {
|
|
value = null;
|
|
} else if (!Ext.isDate(value)) {
|
|
value = new Date(value * 1000);
|
|
}
|
|
}
|
|
me.callParent([value]);
|
|
},
|
|
|
|
});
|