@eclipse-scout/core 22.0.22 → 22.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eclipse-scout-core-a56958ac9954d00cc62a.min.js +2 -0
- package/dist/eclipse-scout-core-a56958ac9954d00cc62a.min.js.map +1 -0
- package/dist/eclipse-scout-core.js +32 -10
- package/dist/eclipse-scout-core.js.map +1 -1
- package/dist/file-list +2 -2
- package/package.json +2 -2
- package/src/scout.js +2 -3
- package/src/text/DateFormat.js +11 -2
- package/src/util/dates.js +16 -6
- package/dist/eclipse-scout-core-c4cad26b336b02535421.min.js +0 -2
- package/dist/eclipse-scout-core-c4cad26b336b02535421.min.js.map +0 -1
|
@@ -80044,11 +80044,10 @@ function assertValue(value, msg) {
|
|
|
80044
80044
|
/**
|
|
80045
80045
|
* Throws an error if the given value is not an instance of the given type. Otherwise, the value is returned.
|
|
80046
80046
|
*
|
|
80047
|
-
* @
|
|
80048
|
-
* @param {T} value - value to check
|
|
80047
|
+
* @param {*} value - value to check
|
|
80049
80048
|
* @param {*} type - type to check against with "instanceof"
|
|
80050
80049
|
* @param {string} [msg] - optional error message when the assertion fails
|
|
80051
|
-
* @return {
|
|
80050
|
+
* @return {*}
|
|
80052
80051
|
*/
|
|
80053
80052
|
|
|
80054
80053
|
function assertInstance(value, type, msg) {
|
|
@@ -109265,11 +109264,22 @@ class DateFormat {
|
|
|
109265
109264
|
// (e.g. MMMM) to short (e.g. M).
|
|
109266
109265
|
|
|
109267
109266
|
this._patternDefinitions = [// --- Year ---
|
|
109267
|
+
// This definition can _format_ dates with years with 4 or more digits.
|
|
109268
|
+
// See: http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html
|
|
109269
|
+
// chapter 'Date and Time Patterns', paragraph 'Year'
|
|
109270
|
+
// We do not allow to _parse_ a date with 5 or more digits. We could allow that in a
|
|
109271
|
+
// future release, but it could have an impact on backend logic, databases, etc.
|
|
109268
109272
|
new _index__WEBPACK_IMPORTED_MODULE_0__.DateFormatPatternDefinition({
|
|
109269
109273
|
type: _index__WEBPACK_IMPORTED_MODULE_0__.DateFormatPatternType.YEAR,
|
|
109270
109274
|
terms: ['yyyy'],
|
|
109275
|
+
// meaning: any number of digits is allowed
|
|
109271
109276
|
dateFormat: this,
|
|
109272
|
-
formatFunction: (formatContext, acceptedTerm) =>
|
|
109277
|
+
formatFunction: (formatContext, acceptedTerm) => {
|
|
109278
|
+
let year = formatContext.inputDate.getFullYear();
|
|
109279
|
+
let numDigits = Math.max(4, year.toString().length); // min. digits = 4
|
|
109280
|
+
|
|
109281
|
+
return _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(formatContext.inputDate.getFullYear(), numDigits).slice(-numDigits);
|
|
109282
|
+
},
|
|
109273
109283
|
parseRegExp: /^(\d{4})(.*)$/,
|
|
109274
109284
|
applyMatchFunction: (parseContext, match, acceptedTerm) => {
|
|
109275
109285
|
parseContext.matchInfo.year = match;
|
|
@@ -127983,6 +127993,8 @@ function compareDays(date1, date2) {
|
|
|
127983
127993
|
* are guaranteed to be digits. If the date argument is omitted, the current date is
|
|
127984
127994
|
* used. The returned string in in UTC if the argument 'utc' is true, otherwise the
|
|
127985
127995
|
* result is in local time (default).
|
|
127996
|
+
*
|
|
127997
|
+
* @deprecated this function will be deleted in release 23.1. Use DateFormat.js instead
|
|
127986
127998
|
*/
|
|
127987
127999
|
|
|
127988
128000
|
function timestamp(date, utc) {
|
|
@@ -128106,7 +128118,7 @@ function parseJsonDate(jsonDate) {
|
|
|
128106
128118
|
milliseconds = '000',
|
|
128107
128119
|
utc = false; // Date + Time
|
|
128108
128120
|
|
|
128109
|
-
let matches =
|
|
128121
|
+
let matches = /^\+?(\d{4,5})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\.(\d{3})(Z?)$/.exec(jsonDate);
|
|
128110
128122
|
|
|
128111
128123
|
if (matches !== null) {
|
|
128112
128124
|
year = matches[1];
|
|
@@ -128119,7 +128131,7 @@ function parseJsonDate(jsonDate) {
|
|
|
128119
128131
|
utc = matches[8] === 'Z';
|
|
128120
128132
|
} else {
|
|
128121
128133
|
// Date only
|
|
128122
|
-
matches =
|
|
128134
|
+
matches = /^\+?(\d{4,5})-(\d{2})-(\d{2})(Z?)$/.exec(jsonDate);
|
|
128123
128135
|
|
|
128124
128136
|
if (matches !== null) {
|
|
128125
128137
|
year = matches[1];
|
|
@@ -128190,12 +128202,12 @@ function toJsonDate(date, utc, includeDate, includeTime) {
|
|
|
128190
128202
|
|
|
128191
128203
|
if (utc) {
|
|
128192
128204
|
// (note: month is 0-indexed)
|
|
128193
|
-
datePart =
|
|
128205
|
+
datePart = getYearPart(date) + '-' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCMonth() + 1, 2) + '-' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCDate(), 2);
|
|
128194
128206
|
timePart = _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCHours(), 2) + ':' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCMinutes(), 2) + ':' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCSeconds(), 2) + '.' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getUTCMilliseconds(), 3);
|
|
128195
128207
|
utcPart = 'Z';
|
|
128196
128208
|
} else {
|
|
128197
128209
|
// (note: month is 0-indexed)
|
|
128198
|
-
datePart =
|
|
128210
|
+
datePart = getYearPart(date) + '-' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getMonth() + 1, 2) + '-' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getDate(), 2);
|
|
128199
128211
|
timePart = _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getHours(), 2) + ':' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getMinutes(), 2) + ':' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getSeconds(), 2) + '.' + _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(date.getMilliseconds(), 3);
|
|
128200
128212
|
utcPart = '';
|
|
128201
128213
|
}
|
|
@@ -128216,6 +128228,16 @@ function toJsonDate(date, utc, includeDate, includeTime) {
|
|
|
128216
128228
|
|
|
128217
128229
|
result += utcPart;
|
|
128218
128230
|
return result;
|
|
128231
|
+
|
|
128232
|
+
function getYearPart(date) {
|
|
128233
|
+
let year = date.getFullYear();
|
|
128234
|
+
|
|
128235
|
+
if (year > 9999) {
|
|
128236
|
+
return '+' + year;
|
|
128237
|
+
}
|
|
128238
|
+
|
|
128239
|
+
return _index__WEBPACK_IMPORTED_MODULE_0__.strings.padZeroLeft(year, 4);
|
|
128240
|
+
}
|
|
128219
128241
|
}
|
|
128220
128242
|
function toJsonDateRange(range) {
|
|
128221
128243
|
return {
|
|
@@ -128229,7 +128251,7 @@ function toJsonDateRange(range) {
|
|
|
128229
128251
|
*
|
|
128230
128252
|
* The format is as follows:
|
|
128231
128253
|
*
|
|
128232
|
-
* [Year#4]-[Month#2]-[Day#2] [Hours#2]:[Minutes#2]:[Seconds#2].[Milliseconds#3][Z]
|
|
128254
|
+
* [Year#4|5]-[Month#2]-[Day#2] [Hours#2]:[Minutes#2]:[Seconds#2].[Milliseconds#3][Z]
|
|
128233
128255
|
*
|
|
128234
128256
|
* The year component is mandatory, but all others are optional (starting from the beginning).
|
|
128235
128257
|
* The date is constructed using the local time zone. If the last character is 'Z', then
|
|
@@ -128238,7 +128260,7 @@ function toJsonDateRange(range) {
|
|
|
128238
128260
|
|
|
128239
128261
|
function create(dateString) {
|
|
128240
128262
|
if (dateString) {
|
|
128241
|
-
let matches = /^(\d{4})(?:-(\d{2})(?:-(\d{2})(?: (\d{2})(?::(\d{2})(?::(\d{2})(?:\.(\d{3}))?(Z?))?)?)?)?)?/.exec(dateString);
|
|
128263
|
+
let matches = /^(\d{4,5})(?:-(\d{2})(?:-(\d{2})(?: (\d{2})(?::(\d{2})(?::(\d{2})(?:\.(\d{3}))?(Z?))?)?)?)?)?/.exec(dateString);
|
|
128242
128264
|
|
|
128243
128265
|
if (matches === null) {
|
|
128244
128266
|
throw new Error('Unparsable date: ' + dateString);
|