inviton-powerduck 0.0.96 → 0.0.97
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/common/date-wrapper.ts +316 -256
- package/common/utils/date-utils.ts +355 -0
- package/components/app/dynamic-component-container.tsx +1 -1
- package/components/app/root-dynamic-component-container.tsx +1 -1
- package/components/button/button.tsx +1 -1
- package/components/button/excel-upload-button.tsx +1 -1
- package/components/button/ladda-button.tsx +1 -1
- package/components/button/text-button.tsx +1 -1
- package/components/button/upload-button.tsx +1 -1
- package/components/card/card-body.tsx +1 -1
- package/components/card/card-header-with-options.tsx +1 -1
- package/components/card/card-header.tsx +1 -1
- package/components/card/card.tsx +1 -1
- package/components/collapse/index.tsx +1 -1
- package/components/contenteditable/index.tsx +1 -1
- package/components/context-menu/context-menu.tsx +1 -1
- package/components/counter/fetchdata.tsx +1 -1
- package/components/counter/index.tsx +1 -1
- package/components/datatable/col-vis-modal.tsx +1 -1
- package/components/datatable/filter-modal.tsx +1 -1
- package/components/dropdown-button/dropdown-button-element.tsx +1 -1
- package/components/dropdown-button/dropdown-button-heading.tsx +1 -1
- package/components/dropdown-button/dropdown-button-item.tsx +1 -1
- package/components/dropdown-button/dropdown-button-separator.tsx +1 -1
- package/components/dropdown-button/language-dropdown-button.tsx +1 -1
- package/components/file-downloader/index.tsx +1 -1
- package/components/form/footer-buttons.tsx +1 -1
- package/components/form/form.tsx +1 -1
- package/components/form/separator.tsx +1 -1
- package/components/form/validation-result-displayer.tsx +1 -1
- package/components/fullcalendar/fullcalendar-draggable-event.tsx +1 -1
- package/components/fullcalendar/timegrid-calendar.tsx +1 -1
- package/components/google/maps.tsx +1 -1
- package/components/highlight-js/index.tsx +1 -1
- package/components/home/index.tsx +1 -1
- package/components/html-literal/html-literal.tsx +1 -1
- package/components/image-crop/image-cropping-modal.tsx +1 -1
- package/components/image-crop/upload-and-crop.tsx +1 -1
- package/components/input/checkbox-without-label.tsx +1 -1
- package/components/input/daterange-picker.tsx +465 -446
- package/components/input/geo-json.tsx +1 -1
- package/components/input/plugins/daterangepicker/jquery.daterangepicker.ts +2046 -1923
- package/components/loading-indicator/index.tsx +1 -1
- package/components/modal/modal-body.tsx +1 -1
- package/components/modal/modal-footer.tsx +1 -1
- package/components/modal-wrap/modal-section-wrapper.tsx +1 -1
- package/components/modal-wrap/modal-subtitle.tsx +1 -1
- package/components/rating/rating-displayer.tsx +1 -1
- package/components/rating/rating-picker.tsx +1 -1
- package/components/share/share-modal.tsx +1 -1
- package/components/share/share.tsx +1 -1
- package/components/sortable/sortable-container.tsx +1 -1
- package/components/sortable/sortable-item.tsx +1 -1
- package/components/spreadsheet/spreadsheet.tsx +1 -1
- package/components/summary-stats/summary-stats.tsx +1 -1
- package/components/swiper/swiper-gallery.tsx +1 -1
- package/components/swiper/swiper-slide.tsx +1 -1
- package/components/swiper/swiper.tsx +1 -1
- package/components/table-wrapper/table-wrapper.tsx +1 -1
- package/components/tilebox/tilebox.tsx +1 -1
- package/components/tooltip/index.tsx +1 -1
- package/components/transition/index.tsx +1 -1
- package/components/wizard/wizard-subtitle.tsx +1 -1
- package/package.json +1 -1
package/common/date-wrapper.ts
CHANGED
|
@@ -4,50 +4,87 @@
|
|
|
4
4
|
* Wrapper for Date class, works without timezones
|
|
5
5
|
*/
|
|
6
6
|
export class DateWrapper {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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(yearOrWrapperOrTimestamp?: number | DateWrapper, month?: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number) {
|
|
14
|
+
if (month != null) {
|
|
15
|
+
this._dte = new Date(Date.UTC(yearOrWrapperOrTimestamp as number, month, date, hours || 0, minutes || 0, seconds || 0, ms || 0));
|
|
16
|
+
} else if (yearOrWrapperOrTimestamp != null) {
|
|
17
|
+
if ((yearOrWrapperOrTimestamp as any)._dte != null) {
|
|
18
|
+
this._dte = new Date(Date.UTC(
|
|
19
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getFullYear(),
|
|
20
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getMonth(),
|
|
21
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getDate(),
|
|
22
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getHours(),
|
|
23
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getMinutes(),
|
|
24
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getSeconds(),
|
|
25
|
+
(yearOrWrapperOrTimestamp as DateWrapper).getMilliseconds()
|
|
26
|
+
));
|
|
27
|
+
} else {
|
|
28
|
+
this._dte = new Date(Number(yearOrWrapperOrTimestamp as number));
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
const now = new Date();
|
|
32
|
+
this._dte = new Date(Date.UTC(
|
|
33
|
+
now.getFullYear(),
|
|
34
|
+
now.getMonth(),
|
|
35
|
+
now.getDate(),
|
|
36
|
+
now.getHours(),
|
|
37
|
+
now.getMinutes(),
|
|
38
|
+
now.getSeconds(),
|
|
39
|
+
now.getMilliseconds()
|
|
40
|
+
));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
clone(): DateWrapper {
|
|
45
|
+
return new DateWrapper(
|
|
46
|
+
this.getFullYear(),
|
|
47
|
+
this.getMonth(),
|
|
48
|
+
this.getDate(),
|
|
49
|
+
this.getHours(),
|
|
50
|
+
this.getMinutes(),
|
|
51
|
+
this.getSeconds(),
|
|
52
|
+
this._dte.getMilliseconds()
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
serialize(): string {
|
|
57
|
+
return this.toWire(true);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
toJSON(key?: any): string {
|
|
61
|
+
return this._dte.toJSON(key);
|
|
62
|
+
//return this.serialize();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
toString(): string {
|
|
66
|
+
return this.toDisplayString();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
toLocaleDateString(opts: Intl.DateTimeFormatOptions & { language?: string }): string {
|
|
70
|
+
opts.timeZone = 'UTC';
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
return this._dte.toLocaleDateString(opts.language || PowerduckState.getCurrentLanguage(), opts);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return this._dte.toString();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
toLocaleTimeString(opts: Intl.DateTimeFormatOptions & { language?: string }): string {
|
|
80
|
+
opts.timeZone = 'UTC';
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
return this._dte.toLocaleTimeString(opts.language || PowerduckState.getCurrentLanguage(), opts);
|
|
84
|
+
} catch (e) {
|
|
85
|
+
return this._dte.toString();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
51
88
|
toDisplayString(options: {
|
|
52
89
|
showTime?: boolean;
|
|
53
90
|
showSeconds?: boolean;
|
|
@@ -56,9 +93,9 @@ export class DateWrapper {
|
|
|
56
93
|
hideDay?: boolean;
|
|
57
94
|
hideMonth?: boolean;
|
|
58
95
|
hideYear?: boolean;
|
|
59
|
-
|
|
96
|
+
language?: string
|
|
60
97
|
}): string;
|
|
61
|
-
|
|
98
|
+
toDisplayString(showTime?: boolean, showSeconds?: boolean, monthLong?: boolean): string;
|
|
62
99
|
toDisplayString(options?: boolean | {
|
|
63
100
|
showTime?: boolean;
|
|
64
101
|
showSeconds?: boolean;
|
|
@@ -67,7 +104,7 @@ export class DateWrapper {
|
|
|
67
104
|
hideDay?: boolean;
|
|
68
105
|
hideMonth?: boolean;
|
|
69
106
|
hideYear?: boolean;
|
|
70
|
-
|
|
107
|
+
language?: string
|
|
71
108
|
}, showTime?: boolean, showSeconds?: boolean, monthLong?: boolean): string {
|
|
72
109
|
let opts = {} as any;
|
|
73
110
|
if (typeof options === 'object') {
|
|
@@ -88,213 +125,236 @@ export class DateWrapper {
|
|
|
88
125
|
timeZone: "UTC",
|
|
89
126
|
} as any as Intl.DateTimeFormatOptions;
|
|
90
127
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
128
|
+
if (showTime || opts.showTime) {
|
|
129
|
+
args.hour = "numeric";
|
|
130
|
+
args.minute = "2-digit";
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (showSeconds || opts.showSeconds) {
|
|
134
|
+
args.second = "2-digit";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
return this._dte.toLocaleDateString(opts.language || PowerduckState.getCurrentLanguage(), args);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return this._dte.toString();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
toDisplayStringNonUtc(showTime?: boolean, showSeconds?: boolean, monthLong?: boolean): string {
|
|
145
|
+
var args = {
|
|
146
|
+
year: "numeric",
|
|
147
|
+
month: monthLong ? "long" : "numeric",
|
|
148
|
+
day: "numeric",
|
|
149
|
+
} as any as Intl.DateTimeFormatOptions;
|
|
150
|
+
|
|
151
|
+
if (showTime) {
|
|
152
|
+
args.hour = "numeric";
|
|
153
|
+
args.minute = "2-digit";
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (showSeconds) {
|
|
157
|
+
args.second = "2-digit";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
return this._dte.toLocaleDateString(PowerduckState.getCurrentLanguage(), args);
|
|
162
|
+
} catch (e) {
|
|
163
|
+
return this._dte.toString();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
getTime(): number {
|
|
168
|
+
return this._dte.getTime();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
getFullYear(): number {
|
|
172
|
+
return this._dte.getUTCFullYear();
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
getMonth(): number {
|
|
176
|
+
return this._dte.getUTCMonth();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
getDate(): number {
|
|
180
|
+
return this._dte.getUTCDate();
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
getDay(): number {
|
|
184
|
+
return this._dte.getUTCDay();
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
getHours(): number {
|
|
188
|
+
return this._dte.getUTCHours();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
getMinutes(): number {
|
|
192
|
+
return this._dte.getUTCMinutes();
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
getSeconds(): number {
|
|
196
|
+
return this._dte.getSeconds();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
getMilliseconds(): number {
|
|
200
|
+
return this._dte.getMilliseconds();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
getTimezoneOffset(): number {
|
|
204
|
+
return this._dte.getTimezoneOffset();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
static getCurrent(): DateWrapper {
|
|
208
|
+
return DateWrapper.fromNonUtcDate(new Date());
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
setTime(time: number): number {
|
|
212
|
+
return this._dte.setTime(time);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
setSeconds(sec: number, ms?: number): number {
|
|
216
|
+
return this._dte.setUTCSeconds(
|
|
217
|
+
sec,
|
|
218
|
+
ms ?? this._dte.getMilliseconds()
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
setMinutes(min: number, sec?: number, ms?: number): number {
|
|
223
|
+
return this._dte.setUTCMinutes(
|
|
224
|
+
min,
|
|
225
|
+
sec ?? this._dte.getUTCMinutes(),
|
|
226
|
+
ms ?? this._dte.getMilliseconds()
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setHours(hours: number, min?: number, sec?: number, ms?: number): number {
|
|
231
|
+
return this._dte.setUTCHours(
|
|
232
|
+
hours,
|
|
233
|
+
min ?? this._dte.getUTCMinutes(),
|
|
234
|
+
sec ?? this._dte.getUTCMinutes(),
|
|
235
|
+
ms ?? this._dte.getMilliseconds()
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
setDate(date: number): number {
|
|
240
|
+
return this._dte.setUTCDate(date);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
setMonth(month: number, date?: number): number {
|
|
244
|
+
return this._dte.setUTCMonth(
|
|
245
|
+
month,
|
|
246
|
+
date ?? this._dte.getUTCDate()
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
setFullYear(year: number, month?: number, date?: number): number {
|
|
251
|
+
return this._dte.setUTCFullYear(
|
|
252
|
+
year,
|
|
253
|
+
month ?? this._dte.getUTCMonth(),
|
|
254
|
+
date ?? this._dte.getUTCDate()
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
toISOString(): string {
|
|
259
|
+
return this.toWire(true, true);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
isDST(): boolean {
|
|
263
|
+
var dstOffset = new Date(this.getFullYear(), 6, 1).getTimezoneOffset();
|
|
264
|
+
if (dstOffset == this.innerDate.getTimezoneOffset()) {
|
|
265
|
+
return true;
|
|
266
|
+
} else {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
get innerDate(): Date {
|
|
272
|
+
return this._dte;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
static isSerializedDate(str: string): boolean {
|
|
276
|
+
return str != null && str.length > 18 && str.length < 29 && str.indexOf("T") == 10;
|
|
277
|
+
}
|
|
278
|
+
static deserialize(str: string): DateWrapper {
|
|
279
|
+
return DateWrapper.fromWire(str);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
static fromNonUtcDate(d: Date): DateWrapper {
|
|
283
|
+
return new DateWrapper(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
static fromWire(value: string): DateWrapper {
|
|
287
|
+
if (value != null && value.length > 0) {
|
|
288
|
+
if (value.indexOf("T") > -1) {
|
|
289
|
+
var year, month, day, hour, minute, second;
|
|
290
|
+
var dtSplit = value.split("T");
|
|
291
|
+
var dateSplit = dtSplit[0].split("-");
|
|
292
|
+
var timeSplit = dtSplit[1].split(":");
|
|
293
|
+
|
|
294
|
+
if (dateSplit.length == 3) {
|
|
295
|
+
year = Number(dateSplit[0]);
|
|
296
|
+
month = Number(dateSplit[1]) - 1;
|
|
297
|
+
day = Number(dateSplit[2]);
|
|
298
|
+
|
|
299
|
+
if (timeSplit.length > 1) {
|
|
300
|
+
hour = Number(timeSplit[0]);
|
|
301
|
+
minute = Number(timeSplit[1]);
|
|
302
|
+
second = timeSplit[2] || 0;
|
|
303
|
+
|
|
304
|
+
if (second != null && second != 0) {
|
|
305
|
+
try {
|
|
306
|
+
if (second.indexOf(".") > -1) {
|
|
307
|
+
second = Number(second.split(".")[0]);
|
|
308
|
+
} else {
|
|
309
|
+
second = Number(second);
|
|
310
|
+
}
|
|
311
|
+
} catch (e) { }
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (isNaN(second)) {
|
|
315
|
+
second = 0;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return new DateWrapper(year, month, day, hour, minute, second, 0);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} else {
|
|
322
|
+
var splitVal = value.split("-");
|
|
323
|
+
if (splitVal.length == 3) {
|
|
324
|
+
return new DateWrapper(Number(splitVal[0]), Number(splitVal[1]) - 1, Number(splitVal[2]), 0, 0, 0, 0);
|
|
325
|
+
} else if (splitVal.length == 5) {
|
|
326
|
+
//TODO:
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
toWire(includeTime?: boolean, includeMs?: boolean): string {
|
|
334
|
+
function formatDatePart(v: number) {
|
|
335
|
+
if (v < 10) {
|
|
336
|
+
return "0" + v.toString();
|
|
337
|
+
} else {
|
|
338
|
+
return v.toString();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
var datePart = this.getFullYear() + "-" + formatDatePart(this.getMonth() + 1) + "-" + formatDatePart(this.getDate());
|
|
343
|
+
if (includeTime) {
|
|
344
|
+
datePart += "T" + formatDatePart(this.getHours()) + ":" + formatDatePart(this.getMinutes()) + ":" + formatDatePart(this.getSeconds());
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (includeMs) {
|
|
348
|
+
var ms = this.innerDate.getMilliseconds().toString();
|
|
349
|
+
if (ms.length == 1) {
|
|
350
|
+
ms = "00" + ms;
|
|
351
|
+
} else if (ms.length == 2) {
|
|
352
|
+
ms = "0" + ms;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
datePart += "." + ms + "Z";
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return datePart;
|
|
359
|
+
}
|
|
300
360
|
}
|