fixed regex to parse time and fixed timeOnly bug

This commit is contained in:
Trent Richardson 2010-09-15 10:15:50 -04:00
parent 1dd304b2f9
commit c9ff8007fd

View file

@ -76,7 +76,7 @@
if (!this.defaults.timeOnly) { if (!this.defaults.timeOnly) {
//the time should come after x number of characters and a space. x = at least the length of text specified by the date format //the time should come after x number of characters and a space. x = at least the length of text specified by the date format
regstr = '.{' + this.defaults.timeFormat.length + ',}\\s+' + regstr; regstr = '.{' + this.defaults.dateFormat.length + ',}\\s+' + regstr;
} }
var order = this.getFormatPositions(); var order = this.getFormatPositions();
@ -306,7 +306,10 @@
var formattedDateTime = this.formattedDate; var formattedDateTime = this.formattedDate;
var timeAvailable = dt !== null && tp_inst.timeDefined; var timeAvailable = dt !== null && tp_inst.timeDefined;
if (this.defaults.timeOnly !== true && (this.defaults.alwaysSetTime || timeAvailable)) { if(this.defaults.timeOnly === true){
formattedDateTime = this.formattedTime;
}
else if (this.defaults.timeOnly !== true && (this.defaults.alwaysSetTime || timeAvailable)) {
formattedDateTime += ' ' + this.formattedTime; formattedDateTime += ' ' + this.formattedTime;
} }