|
95 | 95 | microsecGrid: 0,
|
96 | 96 | alwaysSetTime: true,
|
97 | 97 | separator: ' ',
|
| 98 | + timePortionLocation: 'right', |
98 | 99 | altFieldTimeOnly: true,
|
99 | 100 | altTimeFormat: null,
|
100 | 101 | altSeparator: null,
|
|
944 | 945 | if (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === false) {
|
945 | 946 | formattedDateTime = this.formattedTime;
|
946 | 947 | } else if ((this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) || (this._defaults.timeOnly === true && this._defaults.timeOnlyShowDate === true)) {
|
947 |
| - formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix; |
| 948 | + if (this._defaults.timePortionLocation === 'left') { |
| 949 | + formattedDateTime = this.formattedTime + this._defaults.timeSuffix + this._defaults.separator + formattedDateTime; |
| 950 | + } else { |
| 951 | + formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix; |
| 952 | + } |
948 | 953 | }
|
949 | 954 |
|
950 | 955 | this.formattedDateTime = formattedDateTime;
|
|
1983 | 1988 | // The idea is to get the number separator occurrences in datetime and the time format requested (since time has
|
1984 | 1989 | // fewer unknowns, mostly numbers and am/pm). We will use the time pattern to split.
|
1985 | 1990 | var separator = computeEffectiveSetting(timeSettings, 'separator'),
|
| 1991 | + timePortionLocation = computeEffectiveSetting(timeSettings, 'timePortionLocation'), |
1986 | 1992 | format = computeEffectiveSetting(timeSettings, 'timeFormat'),
|
1987 | 1993 | timeParts = format.split(separator), // how many occurrences of separator may be in our format?
|
1988 | 1994 | timePartsLen = timeParts.length,
|
1989 | 1995 | allParts = dateTimeString.split(separator),
|
1990 | 1996 | allPartsLen = allParts.length;
|
1991 | 1997 |
|
1992 | 1998 | if (allPartsLen > 1) {
|
1993 |
| - return { |
1994 |
| - dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator), |
1995 |
| - timeString: allParts.splice(0, timePartsLen).join(separator) |
1996 |
| - }; |
| 1999 | + if (timePortionLocation === 'left') { |
| 2000 | + return { |
| 2001 | + timeString: allParts.splice(0, allPartsLen - timePartsLen).join(separator), |
| 2002 | + dateString: allParts.splice(0, timePartsLen).join(separator) |
| 2003 | + }; |
| 2004 | + } else { |
| 2005 | + return { |
| 2006 | + dateString: allParts.splice(0, allPartsLen - timePartsLen).join(separator), |
| 2007 | + timeString: allParts.splice(0, timePartsLen).join(separator) |
| 2008 | + }; |
| 2009 | + } |
1997 | 2010 | }
|
1998 | 2011 |
|
1999 | 2012 | return {
|
|
0 commit comments