@beinformed/ui 1.59.1 → 1.59.3

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/esm/models/attributes/DatetimeAttributeModel.js +0 -7
  3. package/esm/models/attributes/DatetimeAttributeModel.js.map +1 -1
  4. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js +7 -2
  5. package/esm/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  6. package/esm/utils/datetime/DateTimeUtil.js +26 -4
  7. package/esm/utils/datetime/DateTimeUtil.js.map +1 -1
  8. package/lib/models/attributes/DatetimeAttributeModel.js +0 -7
  9. package/lib/models/attributes/DatetimeAttributeModel.js.flow +0 -9
  10. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  11. package/lib/models/attributes/__tests__/DatetimeAttributeModel.spec.js.flow +29 -0
  12. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js +7 -2
  13. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.flow +5 -2
  14. package/lib/models/attributes/input-constraints/DateBoundaryConstraint.js.map +1 -1
  15. package/lib/utils/datetime/DateTimeUtil.js +26 -4
  16. package/lib/utils/datetime/DateTimeUtil.js.flow +26 -2
  17. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  18. package/lib/utils/datetime/__tests__/DateTime.spec.js.flow +7 -0
  19. package/lib/utils/datetime/__tests__/DateTimeFormat.spec.js.flow +141 -0
  20. package/package.json +1 -1
  21. package/src/models/attributes/DatetimeAttributeModel.js +0 -9
  22. package/src/models/attributes/__tests__/DatetimeAttributeModel.spec.js +29 -0
  23. package/src/models/attributes/input-constraints/DateBoundaryConstraint.js +5 -2
  24. package/src/utils/datetime/DateTimeUtil.js +26 -2
  25. package/src/utils/datetime/__tests__/DateTime.spec.js +7 -0
  26. package/src/utils/datetime/__tests__/DateTimeFormat.spec.js +141 -0
  27. package/types/constants/Constants.d.ts +9 -0
  28. package/types/constants/Settings.d.ts +6 -3
  29. package/types/models/actions/ActionCollection.d.ts +2 -1
  30. package/types/models/actions/ActionModel.d.ts +1 -1
  31. package/types/models/attributes/AttributeCollection.d.ts +5 -1
  32. package/types/models/attributes/AttributeSetModel.d.ts +2 -1
  33. package/types/models/attributes/ChoiceAttributeOptionCollection.d.ts +7 -5
  34. package/types/models/attributes/ChoiceAttributeOptionModel.d.ts +7 -3
  35. package/types/models/attributes/CompositeAttributeChildCollection.d.ts +4 -3
  36. package/types/models/attributes/DatetimeAttributeModel.d.ts +66 -45
  37. package/types/models/attributes/_createAttribute.d.ts +2 -1
  38. package/types/models/attributes/input-constraints/DateBoundaryConstraint.d.ts +56 -40
  39. package/types/models/attributes/input-constraints/DatetimeFormatConstraint.d.ts +64 -42
  40. package/types/models/attributes/input-constraints/RangeConstraint.d.ts +55 -41
  41. package/types/models/base/BaseModel.d.ts +12 -1
  42. package/types/models/concepts/ConceptDetailModel.d.ts +4 -4
  43. package/types/models/concepts/ConceptIndexModel.d.ts +4 -0
  44. package/types/models/concepts/ConceptLinkModel.d.ts +2 -5
  45. package/types/models/concepts/ConceptRelationCollection.d.ts +3 -1
  46. package/types/models/concepts/ConceptRelationModel.d.ts +3 -1
  47. package/types/models/concepts/ConceptTypeDetailModel.d.ts +5 -9
  48. package/types/models/concepts/SourceReferenceCollection.d.ts +2 -1
  49. package/types/models/concepts/SourceReferenceModel.d.ts +3 -1
  50. package/types/models/content/ContentLinkModel.d.ts +2 -1
  51. package/types/models/content/SectionModel.d.ts +2 -1
  52. package/types/models/content/SubSectionModel.d.ts +6 -1
  53. package/types/models/error/ErrorResponse.d.ts +9 -1
  54. package/types/models/filters/FilterCollection.d.ts +3 -2
  55. package/types/models/grouping/GroupingModel.d.ts +4 -3
  56. package/types/models/href/Href.d.ts +26 -3
  57. package/types/models/index.d.ts +1 -0
  58. package/types/models/links/LinkCollection.d.ts +2 -1
  59. package/types/models/links/LinkModel.d.ts +3 -2
  60. package/types/models/list/ListItemModel.d.ts +2 -1
  61. package/types/models/lookup/LookupOptionCollection.d.ts +2 -1
  62. package/types/models/modelcatalog/ModelCatalogModel.d.ts +5 -0
  63. package/types/models/modelcatalog/ModelCategoryCollection.d.ts +11 -0
  64. package/types/models/modelcatalog/ModelCategoryModel.d.ts +39 -0
  65. package/types/models/taskgroup/TaskGroupModel.d.ts +2 -1
  66. package/types/models/types.d.ts +4 -0
  67. package/types/modularui/CaptchaRequest.d.ts +9 -0
  68. package/types/modularui/ModularUIRequest.d.ts +14 -1
  69. package/types/modularui/ModularUIResponse.d.ts +22 -0
  70. package/types/modularui/UploadRequest.d.ts +7 -1
  71. package/types/redux/_modularui/types.d.ts +3 -0
  72. package/types/redux/types.d.ts +8 -1
  73. package/types/utils/datetime/DateTimeUtil.d.ts +91 -45
  74. package/types/utils/fetch/types.d.ts +2 -0
  75. package/types/utils/helpers/createHref.d.ts +4 -3
  76. package/types/utils/helpers/repositoryResource.d.ts +1 -1
@@ -0,0 +1,141 @@
1
+ import { TimestampUtil } from "../DateTimeUtil";
2
+ import { INCLUDE_TIME_OFFSET, setSettings } from "../../../constants";
3
+
4
+ const timestamp = "2023-06-07T07:04:01.010+02:00";
5
+
6
+ describe("date time format conversion", () => {
7
+ beforeEach(() => {
8
+ TimestampUtil.setTimeZone("Europe/Amsterdam");
9
+ setSettings({ [INCLUDE_TIME_OFFSET]: true });
10
+ });
11
+
12
+ test("Year", () => {
13
+ expect(TimestampUtil.toFormat(timestamp, "yy")).toBe("23");
14
+ expect(TimestampUtil.toFormat(timestamp, "yyyy")).toBe("2023");
15
+ });
16
+
17
+ test("Month", () => {
18
+ expect(TimestampUtil.toFormat(timestamp, "M")).toBe("6");
19
+ expect(TimestampUtil.toFormat(timestamp, "MM")).toBe("06");
20
+ expect(TimestampUtil.toFormat(timestamp, "MMM")).toBe("Jun");
21
+ expect(TimestampUtil.toFormat(timestamp, "MMMM")).toBe("June");
22
+ expect(TimestampUtil.toFormat(timestamp, "MMMMM")).toBe("J");
23
+
24
+ expect(TimestampUtil.toFormat(timestamp, "L")).toBe("6");
25
+ expect(TimestampUtil.toFormat(timestamp, "LL")).toBe("06");
26
+ expect(TimestampUtil.toFormat(timestamp, "LLL")).toBe("Jun");
27
+ expect(TimestampUtil.toFormat(timestamp, "LLLL")).toBe("June");
28
+ expect(TimestampUtil.toFormat(timestamp, "LLLLL")).toBe("J");
29
+ });
30
+
31
+ test("Day", () => {
32
+ expect(TimestampUtil.toFormat(timestamp, "d")).toBe("7");
33
+ expect(TimestampUtil.toFormat(timestamp, "dd")).toBe("07");
34
+ });
35
+
36
+ test("Quarter", () => {
37
+ expect(TimestampUtil.toFormat(timestamp, "Q")).toBe("2");
38
+ expect(TimestampUtil.toFormat(timestamp, "QQ")).toBe("02");
39
+ expect(TimestampUtil.toFormat(timestamp, "QQQ")).toBe("Q2");
40
+ expect(TimestampUtil.toFormat(timestamp, "QQQQ")).toBe("2nd quarter");
41
+ });
42
+
43
+ test.skip("Day of Year", () => {
44
+ expect(TimestampUtil.toFormat(timestamp, "D")).toBe("7");
45
+ expect(TimestampUtil.toFormat(timestamp, "DD")).toBe("07");
46
+ expect(TimestampUtil.toFormat(timestamp, "DDD")).toBe("07");
47
+ });
48
+
49
+ test("Day of Week", () => {
50
+ expect(TimestampUtil.toFormat(timestamp, "E")).toBe("Wed");
51
+ expect(TimestampUtil.toFormat(timestamp, "EEEE")).toBe("Wednesday");
52
+ expect(TimestampUtil.toFormat(timestamp, "EEEEE")).toBe("W");
53
+
54
+ expect(TimestampUtil.toFormat(timestamp, "e")).toBe("3");
55
+ expect(TimestampUtil.toFormat(timestamp, "ee")).toBe("03");
56
+ expect(TimestampUtil.toFormat(timestamp, "eee")).toBe("Wed");
57
+ expect(TimestampUtil.toFormat(timestamp, "eeee")).toBe("Wednesday");
58
+ expect(TimestampUtil.toFormat(timestamp, "eeeee")).toBe("W");
59
+ });
60
+
61
+ test("Week", () => {
62
+ expect(TimestampUtil.toFormat(timestamp, "w")).toBe("23");
63
+ // expect(TimestampUtil.toFormat(timestamp, "W")).toBe("23");
64
+ // expect(TimestampUtil.toFormat(timestamp, "F")).toBe("W");
65
+ });
66
+
67
+ test("Hour", () => {
68
+ expect(TimestampUtil.toFormat(timestamp, "H")).toBe("7");
69
+ expect(TimestampUtil.toFormat(timestamp, "HH")).toBe("07");
70
+ expect(TimestampUtil.toFormat(timestamp, "h")).toBe("7");
71
+ expect(TimestampUtil.toFormat(timestamp, "hh")).toBe("07");
72
+
73
+ expect(TimestampUtil.toFormat(timestamp, "a")).toBe("AM");
74
+ expect(TimestampUtil.toFormat(timestamp, "aa")).toBe("AM");
75
+ expect(TimestampUtil.toFormat(timestamp, "aaa")).toBe("am");
76
+ expect(TimestampUtil.toFormat(timestamp, "aaaa")).toBe("a.m.");
77
+ expect(TimestampUtil.toFormat(timestamp, "aaaaa")).toBe("a");
78
+
79
+ expect(TimestampUtil.toFormat(timestamp, "K")).toBe("7");
80
+ expect(TimestampUtil.toFormat(timestamp, "k")).toBe("7");
81
+ });
82
+
83
+ test("Minute", () => {
84
+ expect(TimestampUtil.toFormat(timestamp, "s")).toBe("1");
85
+ expect(TimestampUtil.toFormat(timestamp, "ss")).toBe("01");
86
+ });
87
+
88
+ test("Milliseconds", () => {
89
+ expect(TimestampUtil.toFormat(timestamp, "SSS")).toBe("010");
90
+ });
91
+
92
+ test("Zone / offset", () => {
93
+ expect(TimestampUtil.toFormat(timestamp, "z")).toBe("GMT+2");
94
+ expect(TimestampUtil.toFormat(timestamp, "zz")).toBe("GMT+2");
95
+ expect(TimestampUtil.toFormat(timestamp, "zzz")).toBe("GMT+2");
96
+ expect(TimestampUtil.toFormat(timestamp, "zzzz")).toBe("GMT+02:00");
97
+ expect(TimestampUtil.toFormat(timestamp, "zzzzz")).toBe("GMT+02:00");
98
+
99
+ expect(TimestampUtil.toFormat(timestamp, "X")).toBe("+02");
100
+ expect(TimestampUtil.toFormat(timestamp, "XX")).toBe("+0200");
101
+ expect(TimestampUtil.toFormat(timestamp, "XXX")).toBe("+02:00");
102
+
103
+ expect(TimestampUtil.toFormat(timestamp, "x")).toBe("+02");
104
+ expect(TimestampUtil.toFormat(timestamp, "xx")).toBe("+0200");
105
+ expect(TimestampUtil.toFormat(timestamp, "xxx")).toBe("+02:00");
106
+
107
+ expect(TimestampUtil.toFormat(timestamp, "O")).toBe("GMT+2");
108
+ expect(TimestampUtil.toFormat(timestamp, "OOOO")).toBe("GMT+02:00");
109
+
110
+ // expect(TimestampUtil.toFormat(timestamp, "VV")).toBe("GMT+02:00");
111
+ // expect(TimestampUtil.toFormat(timestamp, "V")).toBe("Europe/Amsterdam");
112
+ // expect(TimestampUtil.toFormat(timestamp, "Z")).toBe("+02:00");
113
+ // expect(TimestampUtil.toFormat(timestamp, "ZZZZ")).toBe("+02:00");
114
+ });
115
+
116
+ test("Era and Chronology", () => {
117
+ expect(TimestampUtil.toFormat(timestamp, "G")).toBe("AD");
118
+ expect(TimestampUtil.toFormat(timestamp, "GGGG")).toBe("Anno Domini");
119
+ expect(TimestampUtil.toFormat(timestamp, "GGGGG")).toBe("A");
120
+
121
+ expect(TimestampUtil.toFormat(timestamp, "u")).toBe("2023");
122
+ });
123
+
124
+ test("Converted", () => {
125
+ const ZZZ = TimestampUtil.convertFormat("ZZZ");
126
+ expect(TimestampUtil.toFormat(timestamp, ZZZ)).toBe("+02:00");
127
+
128
+ const ZZ = TimestampUtil.convertFormat("ZZ");
129
+ expect(TimestampUtil.toFormat(timestamp, ZZ)).toBe("+0200");
130
+
131
+ const Z = TimestampUtil.convertFormat("Z");
132
+ expect(TimestampUtil.toFormat(timestamp, Z)).toBe("+02");
133
+
134
+ const fullDateTime = TimestampUtil.convertFormat(
135
+ "EEE MMM dd, yyyy h:mma ZZ",
136
+ );
137
+ expect(TimestampUtil.toFormat(timestamp, fullDateTime)).toBe(
138
+ "Wed Jun 07, 2023 7:04AM +0200",
139
+ );
140
+ });
141
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.59.1",
3
+ "version": "1.59.3",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -385,15 +385,6 @@ class DatetimeAttributeModel extends StringAttributeModel {
385
385
  return DateUtil.toFormat(value, this.dateReadonlyFormat);
386
386
  }
387
387
 
388
- if (this.hasDate && this.hasTime) {
389
- const dateTimeReadonlyFormat = `${this.dateReadonlyFormat} ${this.timeReadonlyFormat}`;
390
- return this.formatUtil.toFormat(value, dateTimeReadonlyFormat);
391
- }
392
-
393
- if (this.type === "date") {
394
- return this.formatUtil.toFormat(value, this.dateReadonlyFormat);
395
- }
396
-
397
388
  return this.formatUtil.toFormat(value, this.format);
398
389
  }
399
390
 
@@ -153,6 +153,35 @@ describe("datetimeAttributeModel", () => {
153
153
  expect(attribute.readonlyvalue).toBe("21-12-2031 17:41");
154
154
  });
155
155
 
156
+ it("can handle custom format", () => {
157
+ const attribute = new DatetimeAttributeModel(
158
+ { value: "2031-12-21T17:41:21" },
159
+ {
160
+ type: "datetime",
161
+ format: "dd-MM-yyyy HH:mm xxx",
162
+ },
163
+ );
164
+ expect(attribute.readonlyvalue).toBe("21-12-2031 17:41 +01:00");
165
+
166
+ const attribute2 = new DatetimeAttributeModel(
167
+ { value: "2031-12-21T17:41:21" },
168
+ {
169
+ type: "datetime",
170
+ format: "dd-MM-yyyy HH:mm Z",
171
+ },
172
+ );
173
+ expect(attribute2.readonlyvalue).toBe("21-12-2031 17:41 +01");
174
+
175
+ const attribute3 = new DatetimeAttributeModel(
176
+ { value: "2031-12-21T17:41:21" },
177
+ {
178
+ type: "datetime",
179
+ format: "EEE MMM dd, yyyy h:mma ZZ",
180
+ },
181
+ );
182
+ expect(attribute3.readonlyvalue).toBe("Sun Dec 21, 2031 5:41PM +0100");
183
+ });
184
+
156
185
  it("returns date part of formatlabel as placeholder if attribute has date and time", () => {
157
186
  const attribute = new DatetimeAttributeModel(
158
187
  {},
@@ -11,6 +11,7 @@ import {
11
11
  IllegalArgumentException,
12
12
  IllegalStateException,
13
13
  } from "../../../exceptions";
14
+ import { DATETIME_OFFSET_FORMAT } from "../../../constants";
14
15
 
15
16
  const INEXACT_DATE_ID = "Constraint.Date.InexactDate";
16
17
  const OUT_OF_RANGE_ID = "Constraint.Date.OutOfRange";
@@ -22,6 +23,7 @@ const ABOVE_MAXIMUM_ID = "Constraint.Date.AboveMaximum";
22
23
  class DateBoundaryConstraint implements IConstraintModel {
23
24
  _type: string;
24
25
  _format: string;
26
+ _formatNoOffset: string;
25
27
  _minDate: ?string;
26
28
  _maxDate: ?string;
27
29
 
@@ -35,6 +37,7 @@ class DateBoundaryConstraint implements IConstraintModel {
35
37
  ) {
36
38
  this._type = type;
37
39
  this._format = format;
40
+ this._formatNoOffset = format.replace(DATETIME_OFFSET_FORMAT, "").trim();
38
41
  this._minDate = minDate;
39
42
  this._maxDate = maxDate;
40
43
  }
@@ -105,10 +108,10 @@ class DateBoundaryConstraint implements IConstraintModel {
105
108
  get parameters(): { "max-date": string | null, "min-date": string | null } {
106
109
  return {
107
110
  "min-date": this.minDate
108
- ? this.formatUtil.toFormat(this.minDate, this.format)
111
+ ? this.formatUtil.toFormat(this.minDate, this._formatNoOffset)
109
112
  : null,
110
113
  "max-date": this.maxDate
111
- ? this.formatUtil.toFormat(this.maxDate, this.format)
114
+ ? this.formatUtil.toFormat(this.maxDate, this._formatNoOffset)
112
115
  : null,
113
116
  };
114
117
  }
@@ -99,8 +99,32 @@ class BaseDateTimeUtil {
99
99
 
100
100
  /**
101
101
  */
102
- convertFormat(sourceFormat: string): string {
103
- return sourceFormat ? sourceFormat : this.getIsoFormat();
102
+ convertFormat(javaFormat: string): string {
103
+ if (!javaFormat) {
104
+ return this.getIsoFormat();
105
+ }
106
+
107
+ const javaToUTS35Map = {
108
+ ZZZ: "xxx",
109
+ ZZ: "xx",
110
+ Z: "x",
111
+ };
112
+
113
+ // Replace Java pattern tokens with UTS #35 tokens
114
+ let uts35Format = javaFormat;
115
+
116
+ // Sort keys by length (descending) to handle multi-character tokens first
117
+ const sortedKeys = Object.keys(javaToUTS35Map).sort(
118
+ (a, b) => b.length - a.length,
119
+ );
120
+
121
+ for (const javaToken of sortedKeys) {
122
+ const uts35Token = javaToUTS35Map[javaToken];
123
+ const regex = new RegExp(javaToken, "g"); // Match all occurrences
124
+ uts35Format = uts35Format.replace(regex, uts35Token);
125
+ }
126
+
127
+ return uts35Format;
104
128
  }
105
129
 
106
130
  /**
@@ -613,6 +613,13 @@ describe("asserts for date/time utilities", () => {
613
613
  expect(TimestampUtil.convertFormat("yyyy-MM-dd HH:mm:ss.SSS")).toBe(
614
614
  "yyyy-MM-dd HH:mm:ss.SSS",
615
615
  );
616
+ expect(TimestampUtil.convertFormat("dd-MM-yyyy HH:mm Z")).toBe(
617
+ "dd-MM-yyyy HH:mm x",
618
+ );
619
+
620
+ expect(TimestampUtil.convertFormat("dd-MM-yyyy HH:mm zzzz")).toBe(
621
+ "dd-MM-yyyy HH:mm zzzz",
622
+ );
616
623
  });
617
624
 
618
625
  it("should render iso timestamp to specified format", () => {
@@ -0,0 +1,141 @@
1
+ import { TimestampUtil } from "../DateTimeUtil";
2
+ import { INCLUDE_TIME_OFFSET, setSettings } from "../../../constants";
3
+
4
+ const timestamp = "2023-06-07T07:04:01.010+02:00";
5
+
6
+ describe("date time format conversion", () => {
7
+ beforeEach(() => {
8
+ TimestampUtil.setTimeZone("Europe/Amsterdam");
9
+ setSettings({ [INCLUDE_TIME_OFFSET]: true });
10
+ });
11
+
12
+ test("Year", () => {
13
+ expect(TimestampUtil.toFormat(timestamp, "yy")).toBe("23");
14
+ expect(TimestampUtil.toFormat(timestamp, "yyyy")).toBe("2023");
15
+ });
16
+
17
+ test("Month", () => {
18
+ expect(TimestampUtil.toFormat(timestamp, "M")).toBe("6");
19
+ expect(TimestampUtil.toFormat(timestamp, "MM")).toBe("06");
20
+ expect(TimestampUtil.toFormat(timestamp, "MMM")).toBe("Jun");
21
+ expect(TimestampUtil.toFormat(timestamp, "MMMM")).toBe("June");
22
+ expect(TimestampUtil.toFormat(timestamp, "MMMMM")).toBe("J");
23
+
24
+ expect(TimestampUtil.toFormat(timestamp, "L")).toBe("6");
25
+ expect(TimestampUtil.toFormat(timestamp, "LL")).toBe("06");
26
+ expect(TimestampUtil.toFormat(timestamp, "LLL")).toBe("Jun");
27
+ expect(TimestampUtil.toFormat(timestamp, "LLLL")).toBe("June");
28
+ expect(TimestampUtil.toFormat(timestamp, "LLLLL")).toBe("J");
29
+ });
30
+
31
+ test("Day", () => {
32
+ expect(TimestampUtil.toFormat(timestamp, "d")).toBe("7");
33
+ expect(TimestampUtil.toFormat(timestamp, "dd")).toBe("07");
34
+ });
35
+
36
+ test("Quarter", () => {
37
+ expect(TimestampUtil.toFormat(timestamp, "Q")).toBe("2");
38
+ expect(TimestampUtil.toFormat(timestamp, "QQ")).toBe("02");
39
+ expect(TimestampUtil.toFormat(timestamp, "QQQ")).toBe("Q2");
40
+ expect(TimestampUtil.toFormat(timestamp, "QQQQ")).toBe("2nd quarter");
41
+ });
42
+
43
+ test.skip("Day of Year", () => {
44
+ expect(TimestampUtil.toFormat(timestamp, "D")).toBe("7");
45
+ expect(TimestampUtil.toFormat(timestamp, "DD")).toBe("07");
46
+ expect(TimestampUtil.toFormat(timestamp, "DDD")).toBe("07");
47
+ });
48
+
49
+ test("Day of Week", () => {
50
+ expect(TimestampUtil.toFormat(timestamp, "E")).toBe("Wed");
51
+ expect(TimestampUtil.toFormat(timestamp, "EEEE")).toBe("Wednesday");
52
+ expect(TimestampUtil.toFormat(timestamp, "EEEEE")).toBe("W");
53
+
54
+ expect(TimestampUtil.toFormat(timestamp, "e")).toBe("3");
55
+ expect(TimestampUtil.toFormat(timestamp, "ee")).toBe("03");
56
+ expect(TimestampUtil.toFormat(timestamp, "eee")).toBe("Wed");
57
+ expect(TimestampUtil.toFormat(timestamp, "eeee")).toBe("Wednesday");
58
+ expect(TimestampUtil.toFormat(timestamp, "eeeee")).toBe("W");
59
+ });
60
+
61
+ test("Week", () => {
62
+ expect(TimestampUtil.toFormat(timestamp, "w")).toBe("23");
63
+ // expect(TimestampUtil.toFormat(timestamp, "W")).toBe("23");
64
+ // expect(TimestampUtil.toFormat(timestamp, "F")).toBe("W");
65
+ });
66
+
67
+ test("Hour", () => {
68
+ expect(TimestampUtil.toFormat(timestamp, "H")).toBe("7");
69
+ expect(TimestampUtil.toFormat(timestamp, "HH")).toBe("07");
70
+ expect(TimestampUtil.toFormat(timestamp, "h")).toBe("7");
71
+ expect(TimestampUtil.toFormat(timestamp, "hh")).toBe("07");
72
+
73
+ expect(TimestampUtil.toFormat(timestamp, "a")).toBe("AM");
74
+ expect(TimestampUtil.toFormat(timestamp, "aa")).toBe("AM");
75
+ expect(TimestampUtil.toFormat(timestamp, "aaa")).toBe("am");
76
+ expect(TimestampUtil.toFormat(timestamp, "aaaa")).toBe("a.m.");
77
+ expect(TimestampUtil.toFormat(timestamp, "aaaaa")).toBe("a");
78
+
79
+ expect(TimestampUtil.toFormat(timestamp, "K")).toBe("7");
80
+ expect(TimestampUtil.toFormat(timestamp, "k")).toBe("7");
81
+ });
82
+
83
+ test("Minute", () => {
84
+ expect(TimestampUtil.toFormat(timestamp, "s")).toBe("1");
85
+ expect(TimestampUtil.toFormat(timestamp, "ss")).toBe("01");
86
+ });
87
+
88
+ test("Milliseconds", () => {
89
+ expect(TimestampUtil.toFormat(timestamp, "SSS")).toBe("010");
90
+ });
91
+
92
+ test("Zone / offset", () => {
93
+ expect(TimestampUtil.toFormat(timestamp, "z")).toBe("GMT+2");
94
+ expect(TimestampUtil.toFormat(timestamp, "zz")).toBe("GMT+2");
95
+ expect(TimestampUtil.toFormat(timestamp, "zzz")).toBe("GMT+2");
96
+ expect(TimestampUtil.toFormat(timestamp, "zzzz")).toBe("GMT+02:00");
97
+ expect(TimestampUtil.toFormat(timestamp, "zzzzz")).toBe("GMT+02:00");
98
+
99
+ expect(TimestampUtil.toFormat(timestamp, "X")).toBe("+02");
100
+ expect(TimestampUtil.toFormat(timestamp, "XX")).toBe("+0200");
101
+ expect(TimestampUtil.toFormat(timestamp, "XXX")).toBe("+02:00");
102
+
103
+ expect(TimestampUtil.toFormat(timestamp, "x")).toBe("+02");
104
+ expect(TimestampUtil.toFormat(timestamp, "xx")).toBe("+0200");
105
+ expect(TimestampUtil.toFormat(timestamp, "xxx")).toBe("+02:00");
106
+
107
+ expect(TimestampUtil.toFormat(timestamp, "O")).toBe("GMT+2");
108
+ expect(TimestampUtil.toFormat(timestamp, "OOOO")).toBe("GMT+02:00");
109
+
110
+ // expect(TimestampUtil.toFormat(timestamp, "VV")).toBe("GMT+02:00");
111
+ // expect(TimestampUtil.toFormat(timestamp, "V")).toBe("Europe/Amsterdam");
112
+ // expect(TimestampUtil.toFormat(timestamp, "Z")).toBe("+02:00");
113
+ // expect(TimestampUtil.toFormat(timestamp, "ZZZZ")).toBe("+02:00");
114
+ });
115
+
116
+ test("Era and Chronology", () => {
117
+ expect(TimestampUtil.toFormat(timestamp, "G")).toBe("AD");
118
+ expect(TimestampUtil.toFormat(timestamp, "GGGG")).toBe("Anno Domini");
119
+ expect(TimestampUtil.toFormat(timestamp, "GGGGG")).toBe("A");
120
+
121
+ expect(TimestampUtil.toFormat(timestamp, "u")).toBe("2023");
122
+ });
123
+
124
+ test("Converted", () => {
125
+ const ZZZ = TimestampUtil.convertFormat("ZZZ");
126
+ expect(TimestampUtil.toFormat(timestamp, ZZZ)).toBe("+02:00");
127
+
128
+ const ZZ = TimestampUtil.convertFormat("ZZ");
129
+ expect(TimestampUtil.toFormat(timestamp, ZZ)).toBe("+0200");
130
+
131
+ const Z = TimestampUtil.convertFormat("Z");
132
+ expect(TimestampUtil.toFormat(timestamp, Z)).toBe("+02");
133
+
134
+ const fullDateTime = TimestampUtil.convertFormat(
135
+ "EEE MMM dd, yyyy h:mma ZZ",
136
+ );
137
+ expect(TimestampUtil.toFormat(timestamp, fullDateTime)).toBe(
138
+ "Wed Jun 07, 2023 7:04AM +0200",
139
+ );
140
+ });
141
+ });
@@ -50,6 +50,10 @@ export const ISO_TIME_FORMAT: "HH:mm:ss";
50
50
  /**
51
51
  */
52
52
  export const ISO_TIMESTAMP_FORMAT: "yyyy-MM-dd'T'HH:mm:ss.SSS";
53
+ /**
54
+ * Offset format is appended to iso datetime and timestamp when isIncludeTimeOffsetInDateTimes = true
55
+ */
56
+ export const DATETIME_OFFSET_FORMAT: "xxx";
53
57
  /**
54
58
  * week starts on monday by default
55
59
  */
@@ -82,6 +86,10 @@ export const IS_SYNC: boolean;
82
86
  * @type {boolean}
83
87
  */
84
88
  export const IS_SERVER: boolean;
89
+ /**
90
+ * @type {boolean}
91
+ */
92
+ export const IS_GRAALJS: boolean;
85
93
  /**
86
94
  * @type {{SUCCESS: string, ERROR: string, INFO: string, WARNING: string}}
87
95
  */
@@ -132,6 +140,7 @@ export namespace ATTRIBUTE_WIDTH {
132
140
  let EXTRA_LARGE: string;
133
141
  }
134
142
  export const ALL_CONTENT_IN_DATA_SETTING: "hasAllContentInData";
143
+ export const INCLUDE_TIME_OFFSET: "isIncludeTimeOffsetInDateTimes";
135
144
  export namespace INTERNAL_LOGIN_TYPE {
136
145
  let JAAS: string;
137
146
  let PAC4J_FORM: string;
@@ -6,11 +6,14 @@ export function allSettings(): {
6
6
  };
7
7
  export function cacheContributions(): boolean;
8
8
  export function getBasePath(): string;
9
- export function getUploadPath(): string;
10
- export function getCaptchaPath(): string;
9
+ export function getBasePathModularUI(): string;
10
+ export function getBasePathServer(): string;
11
+ export function getUploadPath(contextPath?: string, origin?: string): string;
12
+ export function getCaptchaPath(contextPath?: string, origin?: string): string;
11
13
  export function hasAllContentInData(): boolean;
14
+ export function isIncludeTimeOffsetInDateTimes(): boolean;
12
15
  export function loginType(): string;
13
- export function loginPath(): string;
16
+ export function loginPath(clientName?: string): string;
14
17
  export function loginUsernameField(): string;
15
18
  export function loginPasswordField(): string;
16
19
  export function logoutPath(): string;
@@ -2,7 +2,7 @@
2
2
  * Collection of actions
3
3
  */
4
4
  export default class ActionCollection extends BaseCollection<ActionModel> {
5
- constructor(actions?: Object, actionsContributions?: Object);
5
+ constructor(actions?: Object, actionsContributions?: Object, modelOptions?: ModelOptions);
6
6
  collection: any[];
7
7
  /**
8
8
  * Retrieve action by key
@@ -27,3 +27,4 @@ export default class ActionCollection extends BaseCollection<ActionModel> {
27
27
  }
28
28
  import ActionModel from "./ActionModel";
29
29
  import BaseCollection from "../base/BaseCollection";
30
+ import { ModelOptions } from "../types";
@@ -4,7 +4,7 @@
4
4
  export default class ActionModel extends BaseModel {
5
5
  /**
6
6
  */
7
- static createFromHref(name: string, href: string, label: string, type?: string): ActionModel;
7
+ static createFromHref(name: string, href: string, label: string, type?: string, origin?: string, contextPath?: string): ActionModel;
8
8
  _fieldCollection: AttributeCollection;
9
9
  _href: Href;
10
10
  _icon: string;
@@ -3,7 +3,7 @@ export default AttributeCollection;
3
3
  * Collection of attributes
4
4
  */
5
5
  declare class AttributeCollection extends ResourceCollection<AttributeType, any> {
6
- constructor(data?: Object | Array<Object>, contributions?: Array<Object>, isReadonly?: boolean);
6
+ constructor(data?: Object | Array<Object>, contributions?: Array<Object>, modelOptions?: AttributeCollectionOptions);
7
7
  /**
8
8
  * Replace attributes with a new array of attributes
9
9
  */
@@ -94,3 +94,7 @@ import ResourceCollection from "../base/ResourceCollection";
94
94
  import ChoiceAttributeModel from "./ChoiceAttributeModel";
95
95
  import { FormErrorAnchor } from "../types";
96
96
  import ContentConfiguration from "../contentconfiguration/ContentConfiguration";
97
+ type AttributeCollectionOptions = {
98
+ ModelOptions: any;
99
+ isReadonly: boolean;
100
+ };
@@ -3,7 +3,7 @@
3
3
  export default class AttributeSetModel extends BaseModel {
4
4
  /**
5
5
  */
6
- constructor(key?: string, data?: Object, contributions?: Object);
6
+ constructor(key?: string, data?: Object, contributions?: Object, modelOptions?: ModelOptions);
7
7
  _key: string;
8
8
  _attributeCollection: AttributeCollection;
9
9
  /**
@@ -33,3 +33,4 @@ export default class AttributeSetModel extends BaseModel {
33
33
  }
34
34
  import BaseModel from "../base/BaseModel";
35
35
  import AttributeCollection from "./AttributeCollection";
36
+ import { ModelOptions } from "../types";
@@ -4,8 +4,9 @@ export default ChoiceAttributeOptionCollection;
4
4
  declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceAttributeOptionModel, any> {
5
5
  /**
6
6
  */
7
- static create(data?: Object, contributions?: Object, referenceDate?: ISO_DATE): ChoiceAttributeOptionCollection;
8
- constructor(initCollection?: ChoiceAttributeOptionModel[]);
7
+ static create(data?: Object, contributions?: Object, modelOptions?: ChoiceAttributeOptionModelOptions): ChoiceAttributeOptionCollection;
8
+ constructor(modelOptions?: ChoiceAttributeOptionModelOptions);
9
+ _modelOptions: ChoiceAttributeOptionModelOptions;
9
10
  _headers: Array<ListHeaderModel>;
10
11
  _sortOptions: boolean;
11
12
  /**
@@ -22,11 +23,11 @@ declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceA
22
23
  getOptionCount(code: string, options: Array<Object>): number | null;
23
24
  /**
24
25
  */
25
- addOptions(data: Object, contributions: Object, referenceDate?: ISO_DATE): ChoiceAttributeOptionCollection;
26
+ addOptions(data: Object, contributions: Object): ChoiceAttributeOptionCollection;
26
27
  /**
27
28
  * Create options based on data and dynamischema
28
29
  */
29
- addDynamicSchema(data: Object, contributions: Object, referenceDate?: ISO_DATE): ChoiceAttributeOptionCollection;
30
+ addDynamicSchema(data: Object, contributions: Object): ChoiceAttributeOptionCollection;
30
31
  /**
31
32
  */
32
33
  addBooleanOption(code: "true" | "false", defaultLabel: string, data: string | Array<string>, options?: Array<Object>): void;
@@ -37,7 +38,7 @@ declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceA
37
38
  addBooleanOptions(value: any, contributions: Object): ChoiceAttributeOptionCollection;
38
39
  /**
39
40
  */
40
- addOption(data: string | Array<string>, contributions: Object, referenceDate?: ISO_DATE): ChoiceAttributeOptionCollection;
41
+ addOption(data: string | Array<string>, contributions: Object): ChoiceAttributeOptionCollection;
41
42
  /**
42
43
  * Get all options that have selected property true
43
44
  */
@@ -76,4 +77,5 @@ declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceA
76
77
  }
77
78
  import ChoiceAttributeOptionModel from "./ChoiceAttributeOptionModel";
78
79
  import ResourceCollection from "../base/ResourceCollection";
80
+ import { ChoiceAttributeOptionModelOptions } from "./ChoiceAttributeOptionModel";
79
81
  import ListHeaderModel from "../list/ListHeaderModel";
@@ -1,3 +1,7 @@
1
+ type ChoiceAttributeOptionModelOptions = {
2
+ ModelOptions: any;
3
+ referenceDate: ISO_DATE;
4
+ };
1
5
  export default ChoiceAttributeOptionModel;
2
6
  /**
3
7
  */
@@ -7,7 +11,7 @@ declare class ChoiceAttributeOptionModel extends BaseModel {
7
11
  static createFromListItemModel(listitem: ListItemModel): ChoiceAttributeOptionModel;
8
12
  /**
9
13
  */
10
- constructor(selectedValues?: Array<string>, option?: Object, referenceDate?: ISO_DATE);
14
+ constructor(selectedValues?: Array<string>, option?: Object, modelOptions?: ChoiceAttributeOptionModelOptions);
11
15
  _code: string;
12
16
  _isSelected: boolean;
13
17
  _referenceDate: ISO_DATE;
@@ -56,7 +60,7 @@ declare class ChoiceAttributeOptionModel extends BaseModel {
56
60
  get attributeCollection(): AttributeCollection;
57
61
  /**
58
62
  */
59
- createAttributeCollection(): AttributeCollection;
63
+ createAttributeCollection(modelOptions?: ChoiceAttributeOptionModelOptions): AttributeCollection;
60
64
  /**
61
65
  * Get label of option for simple codemaps (e.g. static codemap)
62
66
  */
@@ -80,7 +84,7 @@ declare class ChoiceAttributeOptionModel extends BaseModel {
80
84
  get count(): number;
81
85
  /**
82
86
  */
83
- addChildren(selectedValues?: Array<string>, option?: Object, referenceDate?: ISO_DATE): ChoiceAttributeOptionCollection;
87
+ addChildren(selectedValues?: Array<string>, option?: Object, modelOptions?: ChoiceAttributeOptionModelOptions): ChoiceAttributeOptionCollection;
84
88
  /**
85
89
  * get children of option
86
90
  */
@@ -5,13 +5,13 @@ export default CompositeAttributeChildCollection;
5
5
  declare class CompositeAttributeChildCollection extends ResourceCollection<AttributeType, any> {
6
6
  /**
7
7
  */
8
- static create(data: Object, contributions: Object): CompositeAttributeChildCollection;
8
+ static create(data: Object, contributions: Object, modelOptions?: ModelOptions): CompositeAttributeChildCollection;
9
9
  /**
10
10
  */
11
- static createStandard(data: Object, contributions: Object): CompositeAttributeChildCollection;
11
+ static createStandard(data: Object, contributions: Object, modelOptions?: ModelOptions): CompositeAttributeChildCollection;
12
12
  /**
13
13
  */
14
- static createMultiData(data: Object, contributions: Object): CompositeAttributeChildCollection;
14
+ static createMultiData(data: Object, contributions: Object, modelOptions?: ModelOptions): CompositeAttributeChildCollection;
15
15
  constructor(initCollection?: AttributeType[]);
16
16
  /**
17
17
  * Get input value of contributions
@@ -54,3 +54,4 @@ declare class CompositeAttributeChildCollection extends ResourceCollection<Attri
54
54
  import { AttributeType } from "../types";
55
55
  import ResourceCollection from "../base/ResourceCollection";
56
56
  import ErrorCollection from "../error/ErrorCollection";
57
+ import { ModelOptions } from "../types";