DateInput/TimeInput/DateTimeInput: don't fail when options are undefined
This commit is contained in:
parent
91ee1419aa
commit
6bdf96fe6b
3 changed files with 10 additions and 11 deletions
|
@ -25,8 +25,9 @@ Ox.DateInput = function(options, self) {
|
||||||
weekday: false,
|
weekday: false,
|
||||||
width: {
|
width: {
|
||||||
day: 32,
|
day: 32,
|
||||||
month: options.format == 'long' ? 80 : (options.format == 'medium' ? 40 : 32),
|
month: options && options.format == 'long' ? 80
|
||||||
weekday: options.format == 'long' ? 80 : 40,
|
: options && options.format == 'medium' ? 40 : 32,
|
||||||
|
weekday: options && options.format == 'long' ? 80 : 40,
|
||||||
year: 48
|
year: 48
|
||||||
}
|
}
|
||||||
}, options || {})
|
}, options || {})
|
||||||
|
@ -108,7 +109,6 @@ Ox.DateInput = function(options, self) {
|
||||||
{title: '', width: 8}, {title: ',', width: 8}
|
{title: '', width: 8}, {title: ',', width: 8}
|
||||||
]),
|
]),
|
||||||
split: split,
|
split: split,
|
||||||
value: self.options.value,
|
|
||||||
width: 0
|
width: 0
|
||||||
}), self);
|
}), self);
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ Ox.DateTimeInput = function(options, self) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
return Ox.formatDate(
|
return Ox.formatDate(
|
||||||
date,
|
date,
|
||||||
'%F ' + (options.seconds || options.milliseconds ? '%T' : '%H:%M')
|
'%F ' + (options && (options.seconds || options.milliseconds) ? '%T' : '%H:%M')
|
||||||
) + (options.milliseconds ? '.' + Ox.pad(date % 1000, 3) : '');
|
) + (options && options.milliseconds ? '.' + Ox.pad(date % 1000, 3) : '');
|
||||||
}()),
|
}()),
|
||||||
weekday: false
|
weekday: false
|
||||||
}, options || {})
|
}, options || {})
|
||||||
|
@ -35,7 +35,7 @@ Ox.DateTimeInput = function(options, self) {
|
||||||
|
|
||||||
self.options.seconds = self.options.seconds || self.options.milliseconds;
|
self.options.seconds = self.options.seconds || self.options.milliseconds;
|
||||||
|
|
||||||
that = Ox.InputGroup({
|
that = Ox.InputGroup(Ox.extend(self.options, {
|
||||||
inputs: [
|
inputs: [
|
||||||
Ox.DateInput({
|
Ox.DateInput({
|
||||||
format: self.options.format,
|
format: self.options.format,
|
||||||
|
@ -52,9 +52,8 @@ Ox.DateTimeInput = function(options, self) {
|
||||||
separators: [
|
separators: [
|
||||||
{title: '', width: 8}
|
{title: '', width: 8}
|
||||||
],
|
],
|
||||||
split: split,
|
split: split
|
||||||
value: self.options.value
|
}), self);
|
||||||
}, self);
|
|
||||||
|
|
||||||
function join() {
|
function join() {
|
||||||
return that.options('inputs').map(function($input) {
|
return that.options('inputs').map(function($input) {
|
||||||
|
|
|
@ -24,8 +24,8 @@ Ox.TimeInput = function(options, self) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
return Ox.formatDate(
|
return Ox.formatDate(
|
||||||
date,
|
date,
|
||||||
options.seconds || options.milliseconds ? '%T' : '%H:%M'
|
options && (options.seconds || options.milliseconds) ? '%T' : '%H:%M'
|
||||||
) + (options.milliseconds ? '.' + Ox.pad(date % 1000, 3) : '');
|
) + (options && options.milliseconds ? '.' + Ox.pad(date % 1000, 3) : '');
|
||||||
}()),
|
}()),
|
||||||
width: {
|
width: {
|
||||||
hours: 32,
|
hours: 32,
|
||||||
|
|
Loading…
Reference in a new issue