inviton-powerduck 0.0.154 → 0.0.155

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 (60) hide show
  1. package/app/powerduck-initializer.ts +3 -3
  2. package/common/api-http.ts +20 -14
  3. package/common/css/ladda-themeless-zoomin.min.css +89 -89
  4. package/common/enum-translation/day-translator.ts +3 -2
  5. package/common/excel/excel-reader.ts +2 -9
  6. package/common/extensions/array-extensions.ts +116 -0
  7. package/common/extensions/string-extensions.ts +92 -0
  8. package/common/extensions/temporal-extensions.ts +115 -0
  9. package/common/scroll-utils.ts +2 -1
  10. package/common/temporal-helpers.ts +551 -0
  11. package/common/timezone-helper.ts +39 -29
  12. package/common/utils/cookie.ts +11 -8
  13. package/common/utils/date-localization-utils.ts +25 -19
  14. package/common/utils/date-utils.ts +37 -47
  15. package/common/utils/form-utils.ts +3 -1
  16. package/common/utils/language-utils.ts +21 -27
  17. package/common/utils/temporal-utils.ts +43 -0
  18. package/common/utils/upload-image-helper.ts +1 -1
  19. package/common/utils/utils.ts +14 -14
  20. package/common/validation.ts +17 -5
  21. package/components/chart-js/line-chart-flot.tsx +9 -9
  22. package/components/chart-js/thirdparty/flot/jquery.flot.categories.min.js +93 -93
  23. package/components/chart-js/thirdparty/flot/jquery.flot.crosshair.min.js +83 -83
  24. package/components/chart-js/thirdparty/flot/jquery.flot.navigate.min.js +270 -270
  25. package/components/chart-js/thirdparty/flot/jquery.flot.pie.min.js +507 -507
  26. package/components/chart-js/thirdparty/flot/jquery.flot.resize.js +7 -9
  27. package/components/chart-js/thirdparty/flot/jquery.flot.resize.min.js +9 -11
  28. package/components/chart-js/thirdparty/flot/jquery.flot.stack.min.js +104 -104
  29. package/components/chart-js/ts/line-chart-contracts.ts +2 -2
  30. package/components/container-with-breakpoints/ts/breakpoint-handler.ts +2 -2
  31. package/components/counter/testall.tsx +89 -75
  32. package/components/datatable/datatable.tsx +2379 -2375
  33. package/components/datatable/export-excel-modal.tsx +12 -14
  34. package/components/datatable/ts/reorder.ts +4 -2
  35. package/components/dropdown/index.tsx +48 -22
  36. package/components/dropdown/mobile/legacy_fdd.ts +10 -11
  37. package/components/dropzone/gallery-dropzone.tsx +394 -382
  38. package/components/fullcalendar/fullcalendar-draggable-event.tsx +8 -7
  39. package/components/fullcalendar/timegrid-calendar.tsx +60 -67
  40. package/components/image-crop/image-cropping-modal.tsx +9 -8
  41. package/components/image-crop/upload-and-crop.tsx +162 -162
  42. package/components/image-crop/vendor/jquery.Jcrop.min.css +344 -344
  43. package/components/import/import-mapper.tsx +2 -2
  44. package/components/input/daterange-picker.tsx +502 -521
  45. package/components/input/datetime-picker.tsx +45 -50
  46. package/components/input/plugins/daterangepicker/daterangepicker.min.css +400 -400
  47. package/components/input/plugins/daterangepicker/jquery.daterangepicker.min.js +346 -339
  48. package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +580 -402
  49. package/components/input/radio-button-group.tsx +2 -2
  50. package/components/input/ts/dateInputHelper.ts +1 -0
  51. package/components/input/wysiwig.tsx +12 -7
  52. package/components/svg/skilift-svg.tsx +6 -6
  53. package/package.json +2 -1
  54. package/common/date-wrapper.ts +0 -422
  55. package/common/utils/array-extend.ts +0 -215
  56. package/common/utils/array-remove.ts +0 -10
  57. package/common/utils/array-sort.ts +0 -56
  58. package/common/utils/capitalize-string.ts +0 -11
  59. package/common/utils/format-string.ts +0 -14
  60. package/common/utils/latinize-string.ts +0 -7
@@ -2,11 +2,11 @@ import type { DropdownButtonItemArgs } from '../dropdown-button/dropdown-button-
2
2
  import type { FormItemWrapperArgs, HintType, MarginType } from '../form/form-item-wrapper';
3
3
  import { Prop, toNative } from 'vue-facing-decorator';
4
4
  import TsxComponent, { Component } from '../../app/vuetsx';
5
- import { capitalize } from '../../common/utils/capitalize-string';
6
5
  import { PortalUtils } from '../../common/utils/utils';
7
6
  import FormItemWrapper from '../form/form-item-wrapper';
8
7
  import HtmlLiteral from '../html-literal/html-literal';
9
8
  import './css/radio-button-group.css';
9
+ import { capitalize } from '../../common/extensions/string-extensions';
10
10
 
11
11
  type RowToString = (row) => string;
12
12
  interface RadioButtonGroupArgs extends FormItemWrapperArgs {
@@ -78,7 +78,7 @@ class RadioButtonGroupComponent extends TsxComponent<RadioButtonGroupArgs> imple
78
78
  for (let i = 0, len = paramArr.length; i < len; i++) {
79
79
  let val = row[paramArr[i]];
80
80
  if (val == null) {
81
- val = row[capitalize(paramArr[i])];
81
+ val = row[paramArr[i][capitalize]()];
82
82
  }
83
83
 
84
84
  if (val != null) {
@@ -58,6 +58,7 @@ export default class DateInputHelper {
58
58
  return cachedValue;
59
59
  }
60
60
 
61
+ // eslint-disable-next-line no-restricted-syntax
61
62
  const date = new Date(Date.UTC(
62
63
  1990,
63
64
  9,
@@ -5,6 +5,7 @@ import { Prop, toNative, Watch } from 'vue-facing-decorator';
5
5
  import PowerduckState from '../../app/powerduck-state';
6
6
  import TsxComponent, { Component } from '../../app/vuetsx';
7
7
  import EsModuleImportHelper from '../../common/utils/esmodule-import-helper';
8
+ import TemporalUtils from '../../common/utils/temporal-utils';
8
9
  import FormItemWrapper from '../form/form-item-wrapper';
9
10
  import { FileManagerDialog, FileManagerModalFileType } from '../modal/ts/file-manager-dialog';
10
11
  import svgIcons from './img/trumbowyg-icons.svg';
@@ -16,8 +17,8 @@ import './plugins/trumbowyg/lang/sk.ts';
16
17
  import './plugins/trumbowyg/custom-cleanpaste';
17
18
  import './plugins/trumbowyg/custom-upload';
18
19
  import './plugins/trumbowyg/custom-colors';
19
- import './plugins/trumbowyg/modal-issues-fix';
20
20
 
21
+ import './plugins/trumbowyg/modal-issues-fix';
21
22
  import 'trumbowyg/plugins/emoji/trumbowyg.emoji.js';
22
23
  import 'trumbowyg/plugins/noembed/trumbowyg.noembed.js';
23
24
  import 'trumbowyg/plugins/fontsize/trumbowyg.fontsize.js';
@@ -101,12 +102,12 @@ class WysiwigEditorComponent extends TsxComponent<WysiwigEditorArgs> implements
101
102
  lineheight: {
102
103
  sizeList: [
103
104
  '0.9',
104
- '1.0',
105
+ '1.0',
105
106
  'normal',
106
- '1.2',
107
- '1.3',
107
+ '1.2',
108
+ '1.3',
108
109
  '1.5',
109
- '2.0'
110
+ '2.0',
110
111
  ],
111
112
  allowCustomSize: true,
112
113
  },
@@ -571,11 +572,15 @@ class WysiwigEditorComponent extends TsxComponent<WysiwigEditorArgs> implements
571
572
  // instance id
572
573
  instanceId: null,
573
574
  };
574
- if (typeof options == 'object') { defaultOptions = $.extend(defaultOptions, options); }
575
+ if (typeof options == 'object') {
576
+ defaultOptions = $.extend(defaultOptions, options);
577
+ }
575
578
 
576
579
  return this.each(function (this: any) {
577
580
  let opt = $.extend({}, defaultOptions);
578
- if (!opt.instanceId) { opt.instanceId = `rsz_${new Date().getTime()}`; }
581
+ if (!opt.instanceId) {
582
+ opt.instanceId = `rsz_${TemporalUtils.dateNowMs()}`;
583
+ }
579
584
 
580
585
  let startPos, startTransition;
581
586
 
@@ -1,6 +1,6 @@
1
- export const SKILIFT_SVG: string = `
2
- <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="512.000000pt" height="512.000000pt" viewBox="0 0 512.000000 512.000000" preserveAspectRatio="xMidYMid meet">
3
- <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)" fill="currentColor" stroke="none">
4
- <path d="M3911 4254 l-1153 -354 -40 34 c-77 66 -211 76 -290 20 -57 -40 -107 -107 -114 -153 l-6 -38 -1127 -345 -1126 -345 -3 -103 c-2 -94 -1 -102 15 -98 10 3 529 161 1154 353 l1135 347 43 -28 42 -29 -5 -55 c-2 -30 -21 -279 -42 -552 l-38 -498 -360 0 c-200 0 -390 -5 -426 -11 -173 -27 -319 -153 -371 -320 -18 -56 -19 -99 -19 -594 0 -495 1 -538 19 -594 50 -161 183 -281 350 -317 98 -20 1924 -20 2022 0 167 36 300 156 350 317 18 56 19 99 19 588 0 444 -2 536 -16 586 -44 170 -197 307 -374 335 -36 5 -227 10 -426 10 l-360 0 -38 498 c-21 273 -40 522 -43 552 -5 53 -4 56 25 73 40 23 72 69 93 131 l17 49 153 48 c85 26 309 95 499 153 852 260 1595 488 1598 490 1 2 1 48 0 103 l-3 100 -1154 -353z m-1913 -2666 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z m820 0 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z m820 0 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z"/>
5
- </g>
6
- </svg>`;
1
+ export const SKILIFT_SVG: string = `
2
+ <svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="512.000000pt" height="512.000000pt" viewBox="0 0 512.000000 512.000000" preserveAspectRatio="xMidYMid meet">
3
+ <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)" fill="currentColor" stroke="none">
4
+ <path d="M3911 4254 l-1153 -354 -40 34 c-77 66 -211 76 -290 20 -57 -40 -107 -107 -114 -153 l-6 -38 -1127 -345 -1126 -345 -3 -103 c-2 -94 -1 -102 15 -98 10 3 529 161 1154 353 l1135 347 43 -28 42 -29 -5 -55 c-2 -30 -21 -279 -42 -552 l-38 -498 -360 0 c-200 0 -390 -5 -426 -11 -173 -27 -319 -153 -371 -320 -18 -56 -19 -99 -19 -594 0 -495 1 -538 19 -594 50 -161 183 -281 350 -317 98 -20 1924 -20 2022 0 167 36 300 156 350 317 18 56 19 99 19 588 0 444 -2 536 -16 586 -44 170 -197 307 -374 335 -36 5 -227 10 -426 10 l-360 0 -38 498 c-21 273 -40 522 -43 552 -5 53 -4 56 25 73 40 23 72 69 93 131 l17 49 153 48 c85 26 309 95 499 153 852 260 1595 488 1598 490 1 2 1 48 0 103 l-3 100 -1154 -353z m-1913 -2666 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z m820 0 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z m820 0 l2 -358 -260 0 -260 0 0 353 c0 195 3 357 7 361 4 3 119 5 257 4 l251 -3 3 -357z"/>
5
+ </g>
6
+ </svg>`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inviton-powerduck",
3
3
  "type": "module",
4
- "version": "0.0.154",
4
+ "version": "0.0.155",
5
5
  "files": [
6
6
  "app/",
7
7
  "common/",
@@ -24,6 +24,7 @@
24
24
  "@fullcalendar/interaction": "4.4.0",
25
25
  "@fullcalendar/resource-timegrid": "4.4.0",
26
26
  "@fullcalendar/resource-timeline": "4.4.0",
27
+ "@js-temporal/polyfill": "^0.5.1",
27
28
  "@monaco-editor/loader": "^1.4.0",
28
29
  "@vitejs/plugin-vue-jsx": "^4.1.0",
29
30
  "@vue-leaflet/vue-leaflet": "^0.10.1",
@@ -1,422 +0,0 @@
1
- import PowerduckState from '../app/powerduck-state';
2
-
3
- /**
4
- * Wrapper for Date class, works without timezones
5
- */
6
- export class DateWrapper {
7
- private _dte: Date = null;
8
-
9
- constructor(d: DateWrapper);
10
- constructor(t: number);
11
- constructor(year?: number | DateWrapper, month?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number);
12
-
13
- constructor(
14
- yearOrWrapperOrTimestamp?: number | DateWrapper,
15
- month?: number,
16
- date?: number,
17
- hours?: number,
18
- minutes?: number,
19
- seconds?: number,
20
- ms?: number,
21
- ) {
22
- if (month != null) {
23
- this._dte = new Date(Date.UTC(
24
- yearOrWrapperOrTimestamp as number,
25
- month,
26
- date,
27
- hours || 0,
28
- minutes || 0,
29
- seconds || 0,
30
- ms || 0,
31
- ));
32
- } else if (yearOrWrapperOrTimestamp != null) {
33
- if ((yearOrWrapperOrTimestamp as any)._dte != null) {
34
- this._dte = new Date(Date.UTC(
35
- (yearOrWrapperOrTimestamp as DateWrapper).getFullYear(),
36
- (yearOrWrapperOrTimestamp as DateWrapper).getMonth(),
37
- (yearOrWrapperOrTimestamp as DateWrapper).getDate(),
38
- (yearOrWrapperOrTimestamp as DateWrapper).getHours(),
39
- (yearOrWrapperOrTimestamp as DateWrapper).getMinutes(),
40
- (yearOrWrapperOrTimestamp as DateWrapper).getSeconds(),
41
- (yearOrWrapperOrTimestamp as DateWrapper).getMilliseconds(),
42
- ));
43
- } else {
44
- this._dte = new Date(Number(yearOrWrapperOrTimestamp as number));
45
- }
46
- } else {
47
- const now = new Date();
48
- this._dte = new Date(Date.UTC(
49
- now.getFullYear(),
50
- now.getMonth(),
51
- now.getDate(),
52
- now.getHours(),
53
- now.getMinutes(),
54
- now.getSeconds(),
55
- now.getMilliseconds(),
56
- ));
57
- }
58
- }
59
-
60
- clone(): DateWrapper {
61
- return new DateWrapper(
62
- this.getFullYear(),
63
- this.getMonth(),
64
- this.getDate(),
65
- this.getHours(),
66
- this.getMinutes(),
67
- this.getSeconds(),
68
- this._dte.getMilliseconds(),
69
- );
70
- }
71
-
72
- serialize(): string {
73
- return this.toWire(true);
74
- }
75
-
76
- toJSON(key?: any): string {
77
- return this._dte.toJSON(key);
78
- // return this.serialize();
79
- }
80
-
81
- toString(): string {
82
- return this.toDisplayString();
83
- }
84
-
85
- toLocaleDateString(opts: Intl.DateTimeFormatOptions & { language?: string }): string {
86
- opts.timeZone = 'UTC';
87
-
88
- try {
89
- return this._dte.toLocaleDateString(opts.language || PowerduckState.getCurrentLanguage(), opts);
90
- } catch (e) {
91
- return this._dte.toString();
92
- }
93
- }
94
-
95
- toLocaleTimeString(opts: Intl.DateTimeFormatOptions & { language?: string }): string {
96
- opts.timeZone = 'UTC';
97
-
98
- try {
99
- return this._dte.toLocaleTimeString(opts.language || PowerduckState.getCurrentLanguage(), opts);
100
- } catch (e) {
101
- return this._dte.toString();
102
- }
103
- }
104
-
105
- toDisplayString(options: {
106
- showTime?: boolean;
107
- showSeconds?: boolean;
108
- monthLong?: boolean;
109
- dayLong?: boolean;
110
- hideDay?: boolean;
111
- hideMonth?: boolean;
112
- hideYear?: boolean;
113
- language?: string;
114
- }): string;
115
- toDisplayString(showTime?: boolean, showSeconds?: boolean, monthLong?: boolean): string;
116
- toDisplayString(
117
- options?: boolean | {
118
- showTime?: boolean;
119
- showSeconds?: boolean;
120
- monthLong?: boolean;
121
- dayLong?: boolean;
122
- hideDay?: boolean;
123
- hideMonth?: boolean;
124
- hideYear?: boolean;
125
- language?: string;
126
- },
127
- showTime?: boolean,
128
- showSeconds?: boolean,
129
- monthLong?: boolean,
130
- ): string {
131
- let opts = {} as any;
132
- if (typeof options === 'object') {
133
- opts = options;
134
- } else {
135
- opts = {
136
- showTime: options as any,
137
- showSeconds: showTime as any,
138
- monthLong: showSeconds,
139
- };
140
- }
141
-
142
- const args = {
143
- year: !opts.hideYear ? 'numeric' : undefined,
144
- month: !opts.hideMonth ? (opts.monthLong ? 'long' : 'numeric') : undefined,
145
- day: !opts.hideDay && !opts.dayLong ? 'numeric' : undefined,
146
- weekday: opts.dayLong ? 'long' : undefined,
147
- timeZone: 'UTC',
148
- } as any as Intl.DateTimeFormatOptions;
149
-
150
- if (showTime || opts.showTime) {
151
- args.hour = 'numeric';
152
- args.minute = '2-digit';
153
- }
154
-
155
- if (showSeconds || opts.showSeconds) {
156
- args.second = '2-digit';
157
- }
158
-
159
- try {
160
- return this._dte.toLocaleDateString(opts.language || PowerduckState.getCurrentLanguage(), args);
161
- } catch (e) {
162
- return this._dte.toString();
163
- }
164
- }
165
-
166
- toDisplayStringNonUtc(
167
- showTime?: boolean,
168
- showSeconds?: boolean,
169
- monthLong?: boolean,
170
- ): string {
171
- const args = {
172
- year: 'numeric',
173
- month: monthLong ? 'long' : 'numeric',
174
- day: 'numeric',
175
- } as any as Intl.DateTimeFormatOptions;
176
-
177
- if (showTime) {
178
- args.hour = 'numeric';
179
- args.minute = '2-digit';
180
- }
181
-
182
- if (showSeconds) {
183
- args.second = '2-digit';
184
- }
185
-
186
- try {
187
- return this._dte.toLocaleDateString(PowerduckState.getCurrentLanguage(), args);
188
- } catch (e) {
189
- return this._dte.toString();
190
- }
191
- }
192
-
193
- getTime(): number {
194
- return this._dte.getTime();
195
- }
196
-
197
- getFullYear(): number {
198
- return this._dte.getUTCFullYear();
199
- }
200
-
201
- getMonth(): number {
202
- return this._dte.getUTCMonth();
203
- }
204
-
205
- getDate(): number {
206
- return this._dte.getUTCDate();
207
- }
208
-
209
- getDay(): number {
210
- return this._dte.getUTCDay();
211
- }
212
-
213
- getHours(): number {
214
- return this._dte.getUTCHours();
215
- }
216
-
217
- getMinutes(): number {
218
- return this._dte.getUTCMinutes();
219
- }
220
-
221
- getSeconds(): number {
222
- return this._dte.getSeconds();
223
- }
224
-
225
- getMilliseconds(): number {
226
- return this._dte.getMilliseconds();
227
- }
228
-
229
- getTimezoneOffset(): number {
230
- return this._dte.getTimezoneOffset();
231
- }
232
-
233
- static getCurrent(): DateWrapper {
234
- return DateWrapper.fromNonUtcDate(new Date());
235
- }
236
-
237
- setTime(time: number): number {
238
- return this._dte.setTime(time);
239
- }
240
-
241
- setSeconds(sec: number, ms?: number): number {
242
- return this._dte.setUTCSeconds(sec, ms ?? this._dte.getMilliseconds());
243
- }
244
-
245
- setMinutes(
246
- min: number,
247
- sec?: number,
248
- ms?: number,
249
- ): number {
250
- return this._dte.setUTCMinutes(
251
- min,
252
- sec ?? this._dte.getUTCMinutes(),
253
- ms ?? this._dte.getMilliseconds(),
254
- );
255
- }
256
-
257
- setHours(
258
- hours: number,
259
- min?: number,
260
- sec?: number,
261
- ms?: number,
262
- ): number {
263
- return this._dte.setUTCHours(
264
- hours,
265
- min ?? this._dte.getUTCMinutes(),
266
- sec ?? this._dte.getUTCMinutes(),
267
- ms ?? this._dte.getMilliseconds(),
268
- );
269
- }
270
-
271
- setDate(date: number): number {
272
- return this._dte.setUTCDate(date);
273
- }
274
-
275
- setMonth(month: number, date?: number): number {
276
- return this._dte.setUTCMonth(month, date ?? this._dte.getUTCDate());
277
- }
278
-
279
- setFullYear(
280
- year: number,
281
- month?: number,
282
- date?: number,
283
- ): number {
284
- return this._dte.setUTCFullYear(
285
- year,
286
- month ?? this._dte.getUTCMonth(),
287
- date ?? this._dte.getUTCDate(),
288
- );
289
- }
290
-
291
- toISOString(): string {
292
- return this.toWire(true, true);
293
- }
294
-
295
- isDST(): boolean {
296
- const dstOffset = new Date(
297
- this.getFullYear(),
298
- 6,
299
- 1,
300
- ).getTimezoneOffset();
301
- if (dstOffset == this.innerDate.getTimezoneOffset()) {
302
- return true;
303
- } else {
304
- return false;
305
- }
306
- }
307
-
308
- get innerDate(): Date {
309
- return this._dte;
310
- }
311
-
312
- static isSerializedDate(str: string): boolean {
313
- return str != null && str.length > 18 && str.length < 29 && str.indexOf('T') == 10;
314
- }
315
-
316
- static deserialize(str: string): DateWrapper {
317
- return DateWrapper.fromWire(str);
318
- }
319
-
320
- static fromNonUtcDate(d: Date): DateWrapper {
321
- return new DateWrapper(Date.UTC(
322
- d.getFullYear(),
323
- d.getMonth(),
324
- d.getDate(),
325
- d.getHours(),
326
- d.getMinutes(),
327
- d.getSeconds(),
328
- ));
329
- }
330
-
331
- static fromWire(value: string): DateWrapper {
332
- if (value != null && value.length > 0) {
333
- if (value.includes('T')) {
334
- let year, month, day, hour, minute, second;
335
- const dtSplit = value.split('T');
336
- const dateSplit = dtSplit[0].split('-');
337
- const timeSplit = dtSplit[1].split(':');
338
-
339
- if (dateSplit.length == 3) {
340
- year = Number(dateSplit[0]);
341
- month = Number(dateSplit[1]) - 1;
342
- day = Number(dateSplit[2]);
343
-
344
- if (timeSplit.length > 1) {
345
- hour = Number(timeSplit[0]);
346
- minute = Number(timeSplit[1]);
347
- second = timeSplit[2] || 0;
348
-
349
- if (second != null && second != 0) {
350
- try {
351
- if (second.includes('.')) {
352
- second = Number(second.split('.')[0]);
353
- } else {
354
- second = Number(second);
355
- }
356
- } catch (e) { }
357
- }
358
-
359
- if (isNaN(second)) {
360
- second = 0;
361
- }
362
-
363
- return new DateWrapper(
364
- year,
365
- month,
366
- day,
367
- hour,
368
- minute,
369
- second,
370
- 0,
371
- );
372
- }
373
- }
374
- } else {
375
- const splitVal = value.split('-');
376
- if (splitVal.length == 3) {
377
- return new DateWrapper(
378
- Number(splitVal[0]),
379
- Number(splitVal[1]) - 1,
380
- Number(splitVal[2]),
381
- 0,
382
- 0,
383
- 0,
384
- 0,
385
- );
386
- } else if (splitVal.length == 5) {
387
- // TODO:
388
- }
389
- }
390
- }
391
-
392
- return null;
393
- }
394
-
395
- toWire(includeTime?: boolean, includeMs?: boolean): string {
396
- function formatDatePart(v: number) {
397
- if (v < 10) {
398
- return `0${v.toString()}`;
399
- } else {
400
- return v.toString();
401
- }
402
- }
403
-
404
- let datePart = `${this.getFullYear()}-${formatDatePart(this.getMonth() + 1)}-${formatDatePart(this.getDate())}`;
405
- if (includeTime) {
406
- datePart += `T${formatDatePart(this.getHours())}:${formatDatePart(this.getMinutes())}:${formatDatePart(this.getSeconds())}`;
407
- }
408
-
409
- if (includeMs) {
410
- let ms = this.innerDate.getMilliseconds().toString();
411
- if (ms.length == 1) {
412
- ms = `00${ms}`;
413
- } else if (ms.length == 2) {
414
- ms = `0${ms}`;
415
- }
416
-
417
- datePart += `.${ms}Z`;
418
- }
419
-
420
- return datePart;
421
- }
422
- }