'use strict'; /*@ Ox.DateTimeInput DateTimeInput Element ([options[, self]]) -> DateTimeInput Element options Options object ampm false is 24h true is am/pm format options are short, medium, long seconds show seconds value defautls to now weekday weekday self Shared private variable change triggered on change of value @*/ Ox.DateTimeInput = function(options, self) { var that; self = Ox.extend(self || {}, { options: Ox.extend({ ampm: false, format: 'short', milliseconds: false, seconds: false, value: (function() { var date = new Date(); return Ox.formatDate( date, '%F ' + (options.seconds || options.milliseconds ? '%T' : '%H:%M') ) + (options.milliseconds ? '.' + Ox.pad(date % 1000, 3) : ''); }()), weekday: false }, options || {}) }); self.options.seconds = self.options.seconds || self.options.milliseconds; that = Ox.InputGroup({ inputs: [ Ox.DateInput({ format: self.options.format, id: 'date', weekday: self.options.weekday }), Ox.TimeInput({ ampm: self.options.ampm, id: 'time', seconds: self.options.seconds }) ], join: join, separators: [ {title: '', width: 8} ], split: split, value: self.options.value }, self); function join() { return that.options('inputs').map(function($input) { return $input.value(); }).join(' '); } function split() { return self.options.value.split(' '); } return that; };