@mediafly/js-ui 51.3.3-0 → 51.3.3-2
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/lib/constants/constants.js +1 -1
- package/lib/constants/constants.js.map +1 -1
- package/lib/date-time-zone-picker/date-time-zone-picker.html +6 -6
- package/lib/date-time-zone-picker/date-time-zone-picker.js +60 -45
- package/lib/date-time-zone-picker/date-time-zone-picker.js.map +1 -1
- package/lib/date-time-zone-picker/datepicker.html +1 -1
- package/lib/date-time-zone-picker/datepicker.js +26 -25
- package/lib/date-time-zone-picker/datepicker.js.map +1 -1
- package/lib/date-time-zone-picker/time-format-filter.js +2 -2
- package/lib/date-time-zone-picker/time-format-filter.js.map +1 -1
- package/lib/date-time-zone-picker/time-zone-picker.js +1 -1
- package/lib/date-time-zone-picker/timepicker.html +1 -2
- package/lib/date-time-zone-picker/timepicker.js +18 -38
- package/lib/date-time-zone-picker/timepicker.js.map +1 -1
- package/lib/time-input/validate-time.js +0 -1
- package/lib/time-input/validate-time.js.map +1 -1
- package/lib/tsconfig.deploy.tsbuildinfo +30 -34
- package/package.json +3 -3
- package/src/components/constants/constants.js +1 -1
- package/src/components/date-time-zone-picker/date-time-zone-picker.html +6 -6
- package/src/components/date-time-zone-picker/date-time-zone-picker.ts +63 -45
- package/src/components/date-time-zone-picker/datepicker.html +1 -1
- package/src/components/date-time-zone-picker/datepicker.ts +28 -27
- package/src/components/date-time-zone-picker/time-format-filter.ts +2 -2
- package/src/components/date-time-zone-picker/time-zone-picker.js +1 -1
- package/src/components/date-time-zone-picker/timepicker.html +1 -2
- package/src/components/date-time-zone-picker/timepicker.js +19 -38
- package/src/components/time-input/validate-time.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-time.js","sourceRoot":"","sources":["../../src/components/time-input/validate-time.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAErC,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,kBAAkB,EAAE,SAAS,gBAAgB;IAE5E,SAAS,IAAI,CAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK;QAE7C,KAAK,CAAC,WAAW,CAAC,UAAU,GAAG,UAAU,UAAU,EAAE,SAAS;YAE7D,
|
|
1
|
+
{"version":3,"file":"validate-time.js","sourceRoot":"","sources":["../../src/components/time-input/validate-time.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAErC,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,kBAAkB,EAAE,SAAS,gBAAgB;IAE5E,SAAS,IAAI,CAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK;QAE7C,KAAK,CAAC,WAAW,CAAC,UAAU,GAAG,UAAU,UAAU,EAAE,SAAS;YAE7D,IAAI,gBAAgB,GAAG;gBACtB,MAAM;gBACN,QAAQ;gBACR,OAAO;aACP,CAAC;YAEF,sEAAsE;YACtE,IAAI,SAAS,KAAK,EAAE,EAAE;gBACrB,OAAO,IAAI,CAAC;aACZ;YAED,4DAA4D;YAC5D,OAAO,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;gBACrC,MAAM,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;gBACpF,OAAO,MAAM,CAAC,OAAO,CAAA;YACtB,CAAC,CAAC,CAAA;QACH,CAAC,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI;KACV,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -386,58 +386,58 @@
|
|
|
386
386
|
"signature": "b896a663ff08ce92a167b7bc598edf6f4a1c13ef5b797ca2e3ffc9b0e779e48e",
|
|
387
387
|
"affectsGlobalScope": false
|
|
388
388
|
},
|
|
389
|
-
"../node_modules/@types/luxon/src/zone.d.ts": {
|
|
390
|
-
"version": "5339f84dfcb7b04aa1c2b4d7713d6128039381447f07abc2e48d36685e2eef44",
|
|
391
|
-
"signature": "5339f84dfcb7b04aa1c2b4d7713d6128039381447f07abc2e48d36685e2eef44",
|
|
392
|
-
"affectsGlobalScope": false
|
|
393
|
-
},
|
|
394
389
|
"../node_modules/@types/luxon/src/settings.d.ts": {
|
|
395
|
-
"version": "
|
|
396
|
-
"signature": "
|
|
390
|
+
"version": "3c706bae5e03bfd2d4da4bb476191b425c6414b4e142cf6419d969df582c257e",
|
|
391
|
+
"signature": "3c706bae5e03bfd2d4da4bb476191b425c6414b4e142cf6419d969df582c257e",
|
|
397
392
|
"affectsGlobalScope": false
|
|
398
393
|
},
|
|
399
394
|
"../node_modules/@types/luxon/src/_util.d.ts": {
|
|
400
|
-
"version": "
|
|
401
|
-
"signature": "
|
|
395
|
+
"version": "f21f46e0fd48bb5051ddc15ea4532fb6fa64bfb822a54fcd9d9d2fd8a366f91c",
|
|
396
|
+
"signature": "f21f46e0fd48bb5051ddc15ea4532fb6fa64bfb822a54fcd9d9d2fd8a366f91c",
|
|
397
|
+
"affectsGlobalScope": false
|
|
398
|
+
},
|
|
399
|
+
"../node_modules/@types/luxon/src/zone.d.ts": {
|
|
400
|
+
"version": "2cb090ebddbcb24d70f7feefd4e3bb9910c61ed0de51a6c6599bfab9405348b8",
|
|
401
|
+
"signature": "2cb090ebddbcb24d70f7feefd4e3bb9910c61ed0de51a6c6599bfab9405348b8",
|
|
402
402
|
"affectsGlobalScope": false
|
|
403
403
|
},
|
|
404
404
|
"../node_modules/@types/luxon/src/misc.d.ts": {
|
|
405
|
-
"version": "
|
|
406
|
-
"signature": "
|
|
405
|
+
"version": "52ed17fe2c0a4bb27a4f13e99234b3d1f364dc27f9bd7964946d5ec62792a0cc",
|
|
406
|
+
"signature": "52ed17fe2c0a4bb27a4f13e99234b3d1f364dc27f9bd7964946d5ec62792a0cc",
|
|
407
407
|
"affectsGlobalScope": false
|
|
408
408
|
},
|
|
409
409
|
"../node_modules/@types/luxon/src/duration.d.ts": {
|
|
410
|
-
"version": "
|
|
411
|
-
"signature": "
|
|
410
|
+
"version": "1eef59c38f38c64fcb60dcab950d8164a54e346eab8123a33141287765ce1a4e",
|
|
411
|
+
"signature": "1eef59c38f38c64fcb60dcab950d8164a54e346eab8123a33141287765ce1a4e",
|
|
412
412
|
"affectsGlobalScope": false
|
|
413
413
|
},
|
|
414
414
|
"../node_modules/@types/luxon/src/interval.d.ts": {
|
|
415
|
-
"version": "
|
|
416
|
-
"signature": "
|
|
415
|
+
"version": "b7648e912cb0958ae992e1b04e5bc78e79f11c7e27abd2b4c095f136a6bb2306",
|
|
416
|
+
"signature": "b7648e912cb0958ae992e1b04e5bc78e79f11c7e27abd2b4c095f136a6bb2306",
|
|
417
417
|
"affectsGlobalScope": false
|
|
418
418
|
},
|
|
419
419
|
"../node_modules/@types/luxon/src/datetime.d.ts": {
|
|
420
|
-
"version": "
|
|
421
|
-
"signature": "
|
|
420
|
+
"version": "c68a4e9814ce3b5fffab0c0aac18172573b73e3853c5d5c509b809403fd434db",
|
|
421
|
+
"signature": "c68a4e9814ce3b5fffab0c0aac18172573b73e3853c5d5c509b809403fd434db",
|
|
422
422
|
"affectsGlobalScope": false
|
|
423
423
|
},
|
|
424
424
|
"../node_modules/@types/luxon/src/info.d.ts": {
|
|
425
|
-
"version": "
|
|
426
|
-
"signature": "
|
|
425
|
+
"version": "ce7dc6a3cbc2310198386d55981572f53742d67a615721f101554da7801a992b",
|
|
426
|
+
"signature": "ce7dc6a3cbc2310198386d55981572f53742d67a615721f101554da7801a992b",
|
|
427
427
|
"affectsGlobalScope": false
|
|
428
428
|
},
|
|
429
429
|
"../node_modules/@types/luxon/src/luxon.d.ts": {
|
|
430
|
-
"version": "
|
|
431
|
-
"signature": "
|
|
430
|
+
"version": "c5641bb951da5d5252e7d8a806ec3c84f42555b5bd6a0879dbf1c7df1b8bd850",
|
|
431
|
+
"signature": "c5641bb951da5d5252e7d8a806ec3c84f42555b5bd6a0879dbf1c7df1b8bd850",
|
|
432
432
|
"affectsGlobalScope": false
|
|
433
433
|
},
|
|
434
434
|
"../node_modules/@types/luxon/index.d.ts": {
|
|
435
|
-
"version": "
|
|
436
|
-
"signature": "
|
|
435
|
+
"version": "137394641f2db26158061d0638106d87919713c4dd17d17b0cdca1972ea0f8c8",
|
|
436
|
+
"signature": "137394641f2db26158061d0638106d87919713c4dd17d17b0cdca1972ea0f8c8",
|
|
437
437
|
"affectsGlobalScope": false
|
|
438
438
|
},
|
|
439
439
|
"../src/components/constants/constants.js": {
|
|
440
|
-
"version": "
|
|
440
|
+
"version": "a25441ad1502777599c67b270c69df28966e2c936060d2c2c6672e08a8b93c98",
|
|
441
441
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
442
442
|
"affectsGlobalScope": false
|
|
443
443
|
},
|
|
@@ -482,27 +482,27 @@
|
|
|
482
482
|
"affectsGlobalScope": false
|
|
483
483
|
},
|
|
484
484
|
"../src/components/date-time-zone-picker/datepicker.ts": {
|
|
485
|
-
"version": "
|
|
485
|
+
"version": "248189c74ccf05d22333c1d7e6a15dbd9d1e72aed2ada660c0dded9d8481302d",
|
|
486
486
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
487
487
|
"affectsGlobalScope": false
|
|
488
488
|
},
|
|
489
489
|
"../src/components/date-time-zone-picker/time-format-filter.ts": {
|
|
490
|
-
"version": "
|
|
490
|
+
"version": "576b080bea72c11b702b9252e3148a7edfe6f6a1fab231a8816f98aafea5ab10",
|
|
491
491
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
492
492
|
"affectsGlobalScope": false
|
|
493
493
|
},
|
|
494
494
|
"../src/components/date-time-zone-picker/time-zone-picker.js": {
|
|
495
|
-
"version": "
|
|
495
|
+
"version": "488076a733d7e36b8ae10e624098d82b25e3699a8ec34476fb8704735343c424",
|
|
496
496
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
497
497
|
"affectsGlobalScope": false
|
|
498
498
|
},
|
|
499
499
|
"../src/components/date-time-zone-picker/timepicker.js": {
|
|
500
|
-
"version": "
|
|
500
|
+
"version": "cc6cfa0aa9252d08f1a501acc80aa58fd7fb06ca700cf48c4dd158fc4a69abf3",
|
|
501
501
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
502
502
|
"affectsGlobalScope": false
|
|
503
503
|
},
|
|
504
504
|
"../src/components/date-time-zone-picker/date-time-zone-picker.ts": {
|
|
505
|
-
"version": "
|
|
505
|
+
"version": "6a093618454e92658f5ad3a5720d30d46598124da4498367fb50062695295e74",
|
|
506
506
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
507
507
|
"affectsGlobalScope": false
|
|
508
508
|
},
|
|
@@ -1497,7 +1497,7 @@
|
|
|
1497
1497
|
"affectsGlobalScope": false
|
|
1498
1498
|
},
|
|
1499
1499
|
"../src/components/time-input/validate-time.js": {
|
|
1500
|
-
"version": "
|
|
1500
|
+
"version": "e7d91339457009a9f41c6606edfeacc608e05ab47d37cfd93878e865eccb138c",
|
|
1501
1501
|
"signature": "f761c91419d0a89422a0004ef1a92929dd4d2d5e5c16758654d8b0467d1998c6",
|
|
1502
1502
|
"affectsGlobalScope": false
|
|
1503
1503
|
},
|
|
@@ -2574,7 +2574,6 @@
|
|
|
2574
2574
|
"../node_modules/@types/luxon/src/misc.d.ts"
|
|
2575
2575
|
],
|
|
2576
2576
|
"../node_modules/@types/luxon/src/info.d.ts": [
|
|
2577
|
-
"../node_modules/@types/luxon/src/datetime.d.ts",
|
|
2578
2577
|
"../node_modules/@types/luxon/src/misc.d.ts",
|
|
2579
2578
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
2580
2579
|
],
|
|
@@ -2593,7 +2592,6 @@
|
|
|
2593
2592
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
2594
2593
|
],
|
|
2595
2594
|
"../node_modules/@types/luxon/src/settings.d.ts": [
|
|
2596
|
-
"../node_modules/@types/luxon/src/datetime.d.ts",
|
|
2597
2595
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
2598
2596
|
],
|
|
2599
2597
|
"../node_modules/@types/luxon/src/zone.d.ts": [
|
|
@@ -4484,7 +4482,6 @@
|
|
|
4484
4482
|
"../node_modules/@types/luxon/src/misc.d.ts"
|
|
4485
4483
|
],
|
|
4486
4484
|
"../node_modules/@types/luxon/src/info.d.ts": [
|
|
4487
|
-
"../node_modules/@types/luxon/src/datetime.d.ts",
|
|
4488
4485
|
"../node_modules/@types/luxon/src/misc.d.ts",
|
|
4489
4486
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
4490
4487
|
],
|
|
@@ -4503,7 +4500,6 @@
|
|
|
4503
4500
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
4504
4501
|
],
|
|
4505
4502
|
"../node_modules/@types/luxon/src/settings.d.ts": [
|
|
4506
|
-
"../node_modules/@types/luxon/src/datetime.d.ts",
|
|
4507
4503
|
"../node_modules/@types/luxon/src/zone.d.ts"
|
|
4508
4504
|
],
|
|
4509
4505
|
"../node_modules/@types/luxon/src/zone.d.ts": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediafly/js-ui",
|
|
3
|
-
"version": "51.3.3-
|
|
3
|
+
"version": "51.3.3-2",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"description": "UI components for Mediafly Angular applications",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"hammerjs": "2.0.8",
|
|
25
25
|
"jquery": "3.6.0",
|
|
26
26
|
"lodash": "4.17.21",
|
|
27
|
-
"luxon": "
|
|
27
|
+
"luxon": "3.4.4",
|
|
28
28
|
"pikaday": "1.8.2",
|
|
29
29
|
"quill": "2.0.2",
|
|
30
30
|
"reflect-metadata": "0.1.13",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/jasmine": "2.8.6",
|
|
48
48
|
"@types/jquery": "3.5.8",
|
|
49
49
|
"@types/lodash": "4.14.176",
|
|
50
|
-
"@types/luxon": "
|
|
50
|
+
"@types/luxon": "3.3.0",
|
|
51
51
|
"@types/screenfull": "4.1.0",
|
|
52
52
|
"autoprefixer": "9.8.5",
|
|
53
53
|
"babel-core": "6.26.3",
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
input-id="{{ inputId }}"
|
|
7
7
|
is-disabled="isDisabled"
|
|
8
8
|
is-required="{{ isRequired }}"
|
|
9
|
-
date-
|
|
9
|
+
date-luxon="dateLuxon"
|
|
10
10
|
on-open="pickerOpened()"
|
|
11
11
|
on-date-change="updateDate(newDate)">
|
|
12
12
|
</mfly:date-picker>
|
|
13
13
|
</div>
|
|
14
14
|
|
|
15
|
-
<div class="o-col-xs-7" ng-show="type === 'datetime' &&
|
|
15
|
+
<div class="o-col-xs-7" ng-show="type === 'datetime' && dateLuxon && !isDisabled">
|
|
16
16
|
<mfly:time-picker
|
|
17
17
|
input-id="{{ inputId }}Time"
|
|
18
|
-
time-
|
|
18
|
+
time-luxon="timeLuxon"
|
|
19
19
|
ng-show="!isDisabled"
|
|
20
|
-
on-time-change="updateTime()">
|
|
20
|
+
on-time-change="updateTime(newTime)">
|
|
21
21
|
</mfly:time-picker>
|
|
22
22
|
|
|
23
23
|
<mfly:time-zone-picker
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
</div>
|
|
29
29
|
|
|
30
30
|
<!-- If the time is disabled, show plain text instead of controls -->
|
|
31
|
-
<div class="o-col-xs-7" ng-show="type === 'datetime' &&
|
|
31
|
+
<div class="o-col-xs-7" ng-show="type === 'datetime' && dateLuxon && isDisabled">
|
|
32
32
|
<div class="pull-left disabled">
|
|
33
|
-
<span>{{
|
|
33
|
+
<span>{{ parentLuxon.toFormat('hh:mm a') }} {{ (timeZone) ? timeZone.display : '' }}</span>
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
36
36
|
</div>
|
|
@@ -31,11 +31,11 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
31
31
|
// When a change is made, this component combines the 3 datetime elements
|
|
32
32
|
// and sends a utc string back to the api
|
|
33
33
|
// ------------------------------------------------------------------
|
|
34
|
-
function
|
|
34
|
+
function initParentLuxonFromAPI(value) {
|
|
35
35
|
|
|
36
36
|
// Create a base DateTime and bound copies for each child component.
|
|
37
37
|
if (value instanceof Date) {
|
|
38
|
-
$scope.
|
|
38
|
+
$scope.parentLuxon = DateTime.fromJSDate(value)
|
|
39
39
|
} else if (typeof value === 'string') {
|
|
40
40
|
// Parse with setZone: true to preserve the offset from the string
|
|
41
41
|
const dt = DateTime.fromISO(value, { setZone: true })
|
|
@@ -54,47 +54,47 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
54
54
|
minutes === 0
|
|
55
55
|
? `UTC${sign}${hours}`
|
|
56
56
|
: `UTC${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`
|
|
57
|
-
$scope.
|
|
57
|
+
$scope.parentLuxon = dt.setZone(zoneString, { keepLocalTime: true })
|
|
58
58
|
$scope.timeZone = matchedZone
|
|
59
59
|
} else {
|
|
60
60
|
// Fallback: just use the parsed DateTime
|
|
61
|
-
$scope.
|
|
61
|
+
$scope.parentLuxon = dt
|
|
62
62
|
$scope.timeZone = null
|
|
63
63
|
}
|
|
64
64
|
} else {
|
|
65
65
|
throw new Error(`Invalid value type ${typeof value} (${value})`)
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
$scope.
|
|
69
|
-
$scope.
|
|
68
|
+
$scope.timeLuxon = DateTime.fromObject({ hour: $scope.parentLuxon.hour, minute: $scope.parentLuxon.minute, second: 0, millisecond: 0 })
|
|
69
|
+
$scope.dateLuxon = DateTime.fromObject({ year: $scope.parentLuxon.year, month: $scope.parentLuxon.month, day: $scope.parentLuxon.day })
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
function
|
|
72
|
+
function initParentLuxonFromDatePicker(newDate) {
|
|
73
73
|
// when selecting a date from null or for the first time we need to
|
|
74
|
-
// initialize the
|
|
75
|
-
$scope.
|
|
74
|
+
// initialize the parentLuxon
|
|
75
|
+
$scope.parentLuxon = DateTime.now()
|
|
76
76
|
|
|
77
|
-
// the
|
|
78
|
-
//
|
|
79
|
-
$scope.
|
|
77
|
+
// the dateLuxon is set by the datepicker, but we want to update the parent
|
|
78
|
+
// luxon to have the same date
|
|
79
|
+
$scope.parentLuxon = $scope.parentLuxon.set({
|
|
80
80
|
month: newDate.month,
|
|
81
81
|
year: newDate.year,
|
|
82
82
|
day: newDate.day
|
|
83
83
|
})
|
|
84
84
|
|
|
85
|
-
// we then init the
|
|
86
|
-
$scope.
|
|
85
|
+
// we then init the timeLuxon with a default of 12:00am
|
|
86
|
+
$scope.timeLuxon = DateTime.fromFormat('12:00 AM', 'hh:mm a')
|
|
87
87
|
|
|
88
|
-
// parent
|
|
89
|
-
$scope.
|
|
90
|
-
hour: $scope.
|
|
91
|
-
minute: $scope.
|
|
88
|
+
// parent luxon will have the now, but should also initially have 12:00am
|
|
89
|
+
$scope.parentLuxon = $scope.parentLuxon.set({
|
|
90
|
+
hour: $scope.timeLuxon.hour,
|
|
91
|
+
minute: $scope.timeLuxon.minute,
|
|
92
92
|
second: 0,
|
|
93
93
|
millisecond: 0,
|
|
94
94
|
})
|
|
95
95
|
|
|
96
96
|
// and init the time zone from the users's local time zone as we did in the initFromAPI function
|
|
97
|
-
$scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.
|
|
97
|
+
$scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentLuxon)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// Formatter runs when incoming values come from the model - this is
|
|
@@ -102,12 +102,12 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
102
102
|
ngModelCtrl.$formatters.push(function (modelValue) {
|
|
103
103
|
|
|
104
104
|
if (modelValue) {
|
|
105
|
-
|
|
105
|
+
initParentLuxonFromAPI(modelValue)
|
|
106
106
|
}
|
|
107
107
|
else {
|
|
108
108
|
// If we don't have a value, we should insure we clear the control
|
|
109
109
|
// by passing NULL to the update function.
|
|
110
|
-
$scope.
|
|
110
|
+
$scope.dateLuxon = null
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
return modelValue
|
|
@@ -117,10 +117,10 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
117
117
|
return modelValue
|
|
118
118
|
})
|
|
119
119
|
|
|
120
|
-
function
|
|
120
|
+
function updateAPIFromLuxon() {
|
|
121
121
|
|
|
122
|
-
if ($scope.
|
|
123
|
-
ngModelCtrl.$setViewValue($scope.
|
|
122
|
+
if ($scope.parentLuxon) {
|
|
123
|
+
ngModelCtrl.$setViewValue($scope.parentLuxon.toISO())
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
ngModelCtrl.$setViewValue(null)
|
|
@@ -130,28 +130,28 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
130
130
|
|
|
131
131
|
$scope.updateDate = function (newDate) {
|
|
132
132
|
// This is fired when the datepicker has updated the date portion of the DateTime
|
|
133
|
-
// Update the
|
|
133
|
+
// Update the parentLuxon with only the date change
|
|
134
134
|
if (newDate) {
|
|
135
|
-
// Update
|
|
136
|
-
$scope.
|
|
135
|
+
// Update dateLuxon to reflect the new date (needed for template visibility)
|
|
136
|
+
$scope.dateLuxon = newDate
|
|
137
137
|
|
|
138
|
-
if ($scope.
|
|
139
|
-
// if we have a parent
|
|
140
|
-
$scope.
|
|
138
|
+
if ($scope.parentLuxon) {
|
|
139
|
+
// if we have a parent luxon update it
|
|
140
|
+
$scope.parentLuxon = $scope.parentLuxon.set({
|
|
141
141
|
month: newDate.month,
|
|
142
142
|
year: newDate.year,
|
|
143
143
|
day: newDate.day
|
|
144
144
|
})
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
147
|
-
// if we do not have a parent
|
|
148
|
-
|
|
147
|
+
// if we do not have a parent luxon b/c no previous date existed
|
|
148
|
+
initParentLuxonFromDatePicker(newDate)
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
else {
|
|
152
152
|
// we are clearing out a date
|
|
153
|
-
$scope.
|
|
154
|
-
$scope.
|
|
153
|
+
$scope.dateLuxon = null
|
|
154
|
+
$scope.parentLuxon = null
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
// changing between DST could alter our UTC offset
|
|
@@ -159,38 +159,56 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
|
|
|
159
159
|
if ($scope.timeZone) {
|
|
160
160
|
$scope.updateTimeZone($scope.timeZone.value)
|
|
161
161
|
}
|
|
162
|
+
|
|
163
|
+
updateAPIFromLuxon()
|
|
162
164
|
}
|
|
163
165
|
|
|
164
166
|
|
|
165
|
-
$scope.updateTime = function () {
|
|
167
|
+
$scope.updateTime = function (newTime) {
|
|
166
168
|
// This is fired when the timepicker has updated the time portion of the DateTime
|
|
167
|
-
// Update the
|
|
168
|
-
$scope.
|
|
169
|
-
hour:
|
|
170
|
-
minute:
|
|
169
|
+
// Update the parentLuxon with only the time change
|
|
170
|
+
$scope.parentLuxon = $scope.parentLuxon.set({
|
|
171
|
+
hour: newTime.hour,
|
|
172
|
+
minute: newTime.minute,
|
|
171
173
|
second: 0,
|
|
172
174
|
millisecond: 0,
|
|
173
175
|
})
|
|
174
176
|
|
|
175
|
-
|
|
177
|
+
updateAPIFromLuxon()
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
$scope.updateTimeZone = function (zoneOffset) {
|
|
179
181
|
|
|
180
|
-
if ($scope.
|
|
182
|
+
if ($scope.parentLuxon !== '') {
|
|
181
183
|
|
|
182
184
|
// The zone offset displays with a dst offset (see date-time-zone-factory for details)
|
|
183
185
|
// When we save back to the API we need to re-account for that offset
|
|
184
186
|
// Create a DateTime to determine if we are dst
|
|
185
|
-
const isDST = DateTime.fromISO($scope.
|
|
187
|
+
const isDST = DateTime.fromISO($scope.parentLuxon.toISO()).isInDST
|
|
186
188
|
|
|
187
189
|
// adjust the zoneOffset passed from the UI if the date is dst
|
|
188
190
|
zoneOffset = (isDST) ? zoneOffset + 1 : zoneOffset
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
|
|
192
|
+
// Convert fractional hours to HH:MM format for Luxon
|
|
193
|
+
// Luxon expects UTC offsets in the format "UTC+HH:MM" or "UTC-HH:MM"
|
|
194
|
+
const sign = zoneOffset >= 0 ? '+' : '-'
|
|
195
|
+
const absOffset = Math.abs(zoneOffset)
|
|
196
|
+
const hours = Math.floor(absOffset)
|
|
197
|
+
const minutes = Math.round((absOffset - hours) * 60)
|
|
198
|
+
|
|
199
|
+
let zoneString
|
|
200
|
+
if (minutes === 0) {
|
|
201
|
+
// For whole hours, we can use the simple format like "UTC+3" or "UTC-5"
|
|
202
|
+
zoneString = `UTC${sign}${hours}`
|
|
203
|
+
} else {
|
|
204
|
+
// For fractional hours, we need the HH:MM format like "UTC+03:30" or "UTC-03:30"
|
|
205
|
+
zoneString = `UTC${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
$scope.parentLuxon = $scope.parentLuxon.setZone(zoneString, { keepLocalTime: true })
|
|
191
209
|
}
|
|
192
210
|
|
|
193
|
-
|
|
211
|
+
updateAPIFromLuxon()
|
|
194
212
|
}
|
|
195
213
|
|
|
196
214
|
$scope.pickerOpened = function () {
|
|
@@ -9,7 +9,7 @@ interface PikadayInstance {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// Wrapper directive for pikaday datepicker component
|
|
12
|
-
// This 3rd party component has
|
|
12
|
+
// This 3rd party component has an optional dependency on moment.js that we no longer use
|
|
13
13
|
angular.module('app').directive('mflyDatePicker', [
|
|
14
14
|
'dateTimeZoneFactory',
|
|
15
15
|
'translateFactory',
|
|
@@ -25,7 +25,7 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
25
25
|
isDisabled: '=',
|
|
26
26
|
isRequired: '@',
|
|
27
27
|
format: '@',
|
|
28
|
-
|
|
28
|
+
dateLuxon: '=',
|
|
29
29
|
onDateChange: '&',
|
|
30
30
|
onOpen: '&'
|
|
31
31
|
},
|
|
@@ -70,24 +70,14 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
70
70
|
// Handler for when a date is 'selected' with the picker
|
|
71
71
|
// selection happens on enter, blur, and by using the popup calendars
|
|
72
72
|
onSelect() {
|
|
73
|
-
// update the bound date
|
|
73
|
+
// update the bound date luxon - convert from JS Date to DateTime
|
|
74
74
|
const selectedDate = picker.getDate()
|
|
75
75
|
|
|
76
|
-
const updateDate = () => {
|
|
77
|
-
$scope.dateMoment = selectedDate ? DateTime.fromJSDate(selectedDate) : null
|
|
78
|
-
// fire a change in the parent directive for the api
|
|
79
|
-
$scope.onDateChange({ newDate: $scope.dateMoment })
|
|
80
|
-
|
|
81
|
-
// Set the form control as dirty and valid when date changes
|
|
82
|
-
$scope.form?.validation?.mflyDatepicker?.$setDirty()
|
|
83
|
-
$scope.form?.validation?.mflyDatepicker?.$setValidity('invalidDate', true)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
76
|
// Safely handle the digest cycle
|
|
87
77
|
if ($scope.$root.$$phase !== '$digest' && $scope.$root.$$phase !== '$apply') {
|
|
88
|
-
$scope.$apply(updateDate)
|
|
78
|
+
$scope.$apply(() => { $scope.updateDate(selectedDate) })
|
|
89
79
|
} else {
|
|
90
|
-
updateDate()
|
|
80
|
+
$scope.updateDate(selectedDate)
|
|
91
81
|
}
|
|
92
82
|
}
|
|
93
83
|
}
|
|
@@ -95,11 +85,21 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
95
85
|
// Handle for the Pikaday component
|
|
96
86
|
const picker = new Pikaday(pikadayOptions)
|
|
97
87
|
|
|
98
|
-
$scope
|
|
88
|
+
$scope.updateDate = function(newDate) {
|
|
89
|
+
$scope.dateLuxon = newDate ? DateTime.fromJSDate(newDate) : null
|
|
90
|
+
// fire a change in the parent directive for the api
|
|
91
|
+
$scope.onDateChange({ newDate: $scope.dateLuxon })
|
|
92
|
+
|
|
93
|
+
// Set the form control as dirty and valid when date changes
|
|
94
|
+
$scope.form?.validation?.mflyDatepicker?.$setDirty()
|
|
95
|
+
$scope.form?.validation?.mflyDatepicker?.$setValidity('invalidDate', true)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
$scope.$watch('dateLuxon', function(newValue: any, oldValue) {
|
|
99
99
|
|
|
100
100
|
if (newValue === oldValue) { // i.e., initializing
|
|
101
|
-
if ($scope.
|
|
102
|
-
picker.setDate($scope.
|
|
101
|
+
if ($scope.dateLuxon) {
|
|
102
|
+
picker.setDate($scope.dateLuxon.toJSDate())
|
|
103
103
|
}
|
|
104
104
|
recursivelySetPristine($scope.form.validation)
|
|
105
105
|
return
|
|
@@ -136,7 +136,7 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
136
136
|
})
|
|
137
137
|
|
|
138
138
|
|
|
139
|
-
$scope.
|
|
139
|
+
$scope.setPikadayLuxon = function() {
|
|
140
140
|
|
|
141
141
|
// Try parsing with any valid format, just like in validateDate
|
|
142
142
|
let tempDateTime
|
|
@@ -154,9 +154,9 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
154
154
|
// Set the date without triggering onSelect to avoid circular updates
|
|
155
155
|
picker.setDate(tempDateTime.toJSDate(), true)
|
|
156
156
|
|
|
157
|
-
// Manually update the
|
|
157
|
+
// Manually update the dateLuxon to trigger reformatting
|
|
158
158
|
const updateDateTime = () => {
|
|
159
|
-
$scope.
|
|
159
|
+
$scope.dateLuxon = tempDateTime
|
|
160
160
|
$scope.onDateChange({ newDate: tempDateTime })
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -184,17 +184,18 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
184
184
|
const parsed = DateTime.fromFormat($scope.dateInputValue.date, format)
|
|
185
185
|
if (parsed.isValid) {
|
|
186
186
|
isValid = true
|
|
187
|
+
$scope.updateDate(parsed.toJSDate())
|
|
187
188
|
break
|
|
188
189
|
}
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
if (isValid) {
|
|
192
|
-
$scope.
|
|
193
|
+
$scope.setPikadayLuxon()
|
|
193
194
|
}
|
|
194
195
|
|
|
195
196
|
} else if ($scope.dateInputValue.date.length === 0) {
|
|
196
|
-
// clear the scope
|
|
197
|
-
$scope.
|
|
197
|
+
// clear the scope luxon
|
|
198
|
+
$scope.dateLuxon = null
|
|
198
199
|
// update the parent component
|
|
199
200
|
$scope.onDateChange({ newDate: null })
|
|
200
201
|
} else {
|
|
@@ -212,14 +213,14 @@ angular.module('app').directive('mflyDatePicker', [
|
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
$scope.onBlur = function() {
|
|
216
|
+
// Validate the date
|
|
217
|
+
$scope.validateDate()
|
|
218
|
+
|
|
215
219
|
// Hide the Pikaday calendar popup
|
|
216
220
|
picker.hide()
|
|
217
221
|
|
|
218
222
|
// Update focus state
|
|
219
223
|
$scope.focusAddOn = false
|
|
220
|
-
|
|
221
|
-
// Validate the date
|
|
222
|
-
$scope.validateDate()
|
|
223
224
|
}
|
|
224
225
|
|
|
225
226
|
$scope.requiredText = translateFactory.instant('JSUI.REQUIRED')
|
|
@@ -32,7 +32,7 @@ angular.module('app').filter('formatTimeWithTimeZone', ['dateTimeZoneFactory', f
|
|
|
32
32
|
|
|
33
33
|
const formattedTime = dateTimeZone.toFormat('h:mm a')
|
|
34
34
|
|
|
35
|
-
// NOTE: getTimeZone expects a
|
|
35
|
+
// NOTE: getTimeZone expects a luxonDate
|
|
36
36
|
const formattedZone = dateTimeZoneFactory.getTimeZone(dateTimeZone).display
|
|
37
37
|
|
|
38
38
|
return `${formattedTime} ${formattedZone}`
|
|
@@ -52,7 +52,7 @@ angular.module('app').filter('formatDateTimeWithTimeZone', ['dateTimeZoneFactory
|
|
|
52
52
|
|
|
53
53
|
const formattedDateTime = DateTime.fromISO(date, { setZone: true }).toFormat('M/dd/yy h:mm a')
|
|
54
54
|
|
|
55
|
-
// NOTE: getTimeZone expects a
|
|
55
|
+
// NOTE: getTimeZone expects a luxonDate
|
|
56
56
|
const formattedZone = dateTimeZoneFactory.getTimeZone(dateTimeZone).display
|
|
57
57
|
|
|
58
58
|
return `${formattedDateTime} ${formattedZone}`
|
|
@@ -36,7 +36,7 @@ angular.module('app').directive('mflyTimeZonePicker', ['dateTimeZoneFactory', fu
|
|
|
36
36
|
//update the bound timeZone object
|
|
37
37
|
$scope.timeZone = $scope.timeZones[index];
|
|
38
38
|
//update the parent component
|
|
39
|
-
//must pass the zone value as the parent
|
|
39
|
+
//must pass the zone value as the parent function does not get the update first
|
|
40
40
|
$scope.onTimeZoneChange({zoneOffset:$scope.timeZone.value});
|
|
41
41
|
}
|
|
42
42
|
};
|