@mediafly/js-ui 51.3.3-1 → 51.4.0-0

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 (49) hide show
  1. package/lib/constants/constants.js +1 -2
  2. package/lib/constants/constants.js.map +1 -1
  3. package/lib/date-input/date-input.js +12 -33
  4. package/lib/date-input/date-input.js.map +1 -1
  5. package/lib/date-input/validate-date.js +8 -12
  6. package/lib/date-input/validate-date.js.map +1 -1
  7. package/lib/date-time-zone-picker/date-time-zone-factory.js +49 -62
  8. package/lib/date-time-zone-picker/date-time-zone-factory.js.map +1 -1
  9. package/lib/date-time-zone-picker/date-time-zone-picker.html +6 -6
  10. package/lib/date-time-zone-picker/date-time-zone-picker.js +59 -119
  11. package/lib/date-time-zone-picker/date-time-zone-picker.js.map +1 -1
  12. package/lib/date-time-zone-picker/datepicker.html +3 -2
  13. package/lib/date-time-zone-picker/datepicker.js +26 -79
  14. package/lib/date-time-zone-picker/datepicker.js.map +1 -1
  15. package/lib/date-time-zone-picker/time-format-filter.js +8 -8
  16. package/lib/date-time-zone-picker/time-format-filter.js.map +1 -1
  17. package/lib/date-time-zone-picker/time-zone-picker.js +1 -1
  18. package/lib/date-time-zone-picker/timepicker.html +2 -1
  19. package/lib/date-time-zone-picker/timepicker.js +40 -35
  20. package/lib/date-time-zone-picker/timepicker.js.map +1 -1
  21. package/lib/feedback/feedback.component.html +17 -7
  22. package/lib/styles.css +10 -22
  23. package/lib/time-input/time-input.js +23 -27
  24. package/lib/time-input/time-input.js.map +1 -1
  25. package/lib/time-input/validate-time.js +3 -6
  26. package/lib/time-input/validate-time.js.map +1 -1
  27. package/lib/tsconfig.deploy.tsbuildinfo +25 -163
  28. package/package.json +4 -4
  29. package/src/components/constants/constants.js +1 -2
  30. package/src/components/date-input/date-input.js +12 -31
  31. package/src/components/date-input/validate-date.js +10 -14
  32. package/src/components/date-time-zone-picker/date-time-zone-factory.ts +49 -62
  33. package/src/components/date-time-zone-picker/date-time-zone-picker.html +6 -6
  34. package/src/components/date-time-zone-picker/date-time-zone-picker.ts +70 -131
  35. package/src/components/date-time-zone-picker/datepicker.html +3 -2
  36. package/src/components/date-time-zone-picker/datepicker.ts +26 -83
  37. package/src/components/date-time-zone-picker/time-format-filter.ts +8 -8
  38. package/src/components/date-time-zone-picker/time-zone-picker.js +1 -1
  39. package/src/components/date-time-zone-picker/timepicker.html +2 -1
  40. package/src/components/date-time-zone-picker/timepicker.js +47 -46
  41. package/src/components/feedback/feedback.component.html +17 -7
  42. package/src/components/feedback/feedback.less +24 -13
  43. package/src/components/less/objects/containers.less +15 -17
  44. package/src/components/less/variables/colors.less +8 -0
  45. package/src/components/time-input/time-input.js +24 -27
  46. package/src/components/time-input/validate-time.js +3 -6
  47. package/src/index.spec.js +1 -1
  48. package/tsconfig.tsbuildinfo +7221 -0
  49. package/webpack.config.js +0 -6
@@ -4,10 +4,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const angular_1 = __importDefault(require("angular"));
7
- const { DateTime } = require('luxon');
8
7
  angular_1.default.module('app')
9
8
  .constant('_', require('lodash'))
10
- .constant('$luxon', DateTime)
9
+ .constant('$moment', require('moment'))
11
10
  .constant('Pikaday', require('pikaday'))
12
11
  .constant('PREFIX', '/components/');
13
12
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/components/constants/constants.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAErC,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC;KACnB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;KAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAC5B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KACvC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/components/constants/constants.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAE7B,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC;KACnB,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;KAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;KACtC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;KACvC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC"}
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const angular_1 = __importDefault(require("angular"));
7
7
  const date_input_html_1 = __importDefault(require("./date-input.html"));
8
- const { DateTime } = require('luxon');
8
+ const moment_1 = __importDefault(require("moment"));
9
9
  const pikaday_1 = __importDefault(require("pikaday"));
10
10
  angular_1.default.module('app').directive('mflyDateInput', ['translateFactory', function mflyDateInput(translateFactory) {
11
11
  return {
@@ -23,12 +23,12 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
23
23
  // Ng-model functionality
24
24
  // ----------------------------------------
25
25
  var validDateFormats = [
26
- 'd-MMM-yyyy', 'd/MMM/yyyy',
27
- 'dd-MMM-yyyy', 'dd/MMM/yyyy',
28
- 'MM-dd-yyyy', 'MM/dd/yyyy',
29
- 'M-d-yyyy', 'M/d/yyyy',
30
- 'MM-dd-yy', 'MM/dd/yy',
31
- 'M-d-yy', 'M/d/yy'
26
+ 'D-MMM-YYYY', 'D/MMM/YYYY',
27
+ 'DD-MMM-YYYY', 'DD/MMM/YYYY',
28
+ 'MM-DD-YYYY', 'MM/DD/YYYY',
29
+ 'M-D-YYYY', 'M/D/YYYY',
30
+ 'MM-DD-YY', 'MM/DD/YY',
31
+ 'M-D-YY', 'M/D/YY'
32
32
  ];
33
33
  // Format the ng-model value as a date string.
34
34
  // The result of this function is assigned to `ngModelCtrl.$viewValue`.
@@ -36,7 +36,7 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
36
36
  if (!nativeDate) {
37
37
  return '';
38
38
  }
39
- return DateTime.fromJSDate(nativeDate).toFormat('dd-MMM-yyyy');
39
+ return moment_1.default(nativeDate).format('DD-MMM-YYYY');
40
40
  });
41
41
  // Display the date string in the UI.
42
42
  ngModelCtrl.$render = function () {
@@ -52,14 +52,7 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
52
52
  $scope.onChange({ value: null });
53
53
  return null;
54
54
  }
55
- // Try parsing with each valid format
56
- let parsedDate;
57
- for (const format of validDateFormats) {
58
- parsedDate = DateTime.fromFormat(viewValue, format);
59
- if (parsedDate.isValid)
60
- break;
61
- }
62
- const jsDate = parsedDate.toJSDate();
55
+ const jsDate = moment_1.default(viewValue, validDateFormats, true).toDate();
63
56
  $scope.onChange({ value: jsDate });
64
57
  return jsDate;
65
58
  });
@@ -68,13 +61,7 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
68
61
  $scope.$watch('date', function (newValue) {
69
62
  if (pikaday) {
70
63
  // We can't rely on native Date() parsing here (JSUI-185).
71
- let parsedDate;
72
- for (const format of validDateFormats) {
73
- parsedDate = DateTime.fromFormat(newValue, format);
74
- if (parsedDate.isValid)
75
- break;
76
- }
77
- pikaday.setDate(parsedDate.toJSDate(), true); // true = do not trigger onSelect
64
+ pikaday.setDate(moment_1.default(newValue, validDateFormats).toDate(), true); // true = do not trigger onSelect
78
65
  }
79
66
  ngModelCtrl.$setViewValue(newValue);
80
67
  });
@@ -90,7 +77,7 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
90
77
  // the scope property with a valid-formatted date string.
91
78
  onSelect: function (newDate) {
92
79
  $scope.$apply(function () {
93
- $scope.date = DateTime.fromJSDate(newDate).toFormat('dd-MMM-yyyy');
80
+ $scope.date = moment_1.default(newDate).format('DD-MMM-YYYY');
94
81
  });
95
82
  },
96
83
  // We can make the input field disabled, but we need further measures
@@ -106,15 +93,7 @@ angular_1.default.module('app').directive('mflyDateInput', ['translateFactory',
106
93
  // object which we initialize from the scope's model date, but ngModel
107
94
  // doesn't fill that value in until the digest cycle has stabilized.
108
95
  setTimeout(function () {
109
- if ($scope.date) {
110
- let parsedDate;
111
- for (const format of validDateFormats) {
112
- parsedDate = DateTime.fromFormat($scope.date, format);
113
- if (parsedDate.isValid)
114
- break;
115
- }
116
- pikadayOptions.defaultDate = parsedDate.toJSDate();
117
- }
96
+ pikadayOptions.defaultDate = moment_1.default($scope.date, validDateFormats).toDate(); // new Date($scope.date)
118
97
  pikaday = new pikaday_1.default(pikadayOptions);
119
98
  }, 0);
120
99
  $scope.requiredText = translateFactory.instant('JSUI.REQUIRED');
@@ -1 +1 @@
1
- {"version":3,"file":"date-input.js","sourceRoot":"","sources":["../../src/components/date-input/date-input.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,wEAAwC;AACxC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AACrC,sDAA6B;AAE7B,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,kBAAkB,EAAE,SAAS,aAAa,CAAE,gBAAgB;QAE7G,OAAO;YACN,QAAQ,EAAE,GAAG;YACb,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE;gBACN,OAAO,EAAE,GAAG;gBACZ,UAAU,EAAE,GAAG;gBACf,QAAQ,EAAE,GAAG;gBACb,QAAQ,EAAE,GAAG;aACb;YACD,QAAQ,EAAR,yBAAQ;YACR,IAAI,EAAE,UAAU,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW;gBAEjD,yBAAyB;gBACzB,2CAA2C;gBAC3C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,CAAA;YACvE,CAAC;SACD,CAAA;IACF,CAAC,CAAC,CAAC,CAAA"}
@@ -4,27 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const angular_1 = __importDefault(require("angular"));
7
- const { DateTime } = require('luxon');
7
+ const moment_1 = __importDefault(require("moment"));
8
8
  angular_1.default.module('app').directive('mflyValidateDate', function mflyValidateDate() {
9
9
  function link($scope, $element, $attrs, $ctrl) {
10
10
  $ctrl.$validators.dateFormat = function (modelValue, viewValue) {
11
11
  var validDateFormats = [
12
- 'd-MMM-yyyy', 'd/MMM/yyyy',
13
- 'dd-MMM-yyyy', 'dd/MMM/yyyy',
14
- 'MM-dd-yyyy', 'MM/dd/yyyy',
15
- 'M-d-yyyy', 'M/d/yyyy',
16
- 'MM-dd-yy', 'MM/dd/yy',
17
- 'M-d-yy', 'M/d/yy'
12
+ 'D-MMM-YYYY', 'D/MMM/YYYY',
13
+ 'DD-MMM-YYYY', 'DD/MMM/YYYY',
14
+ 'MM-DD-YYYY', 'MM/DD/YYYY',
15
+ 'M-D-YYYY', 'M/D/YYYY',
16
+ 'MM-DD-YY', 'MM/DD/YY',
17
+ 'M-D-YY', 'M/D/YY'
18
18
  ];
19
19
  // Empty models shouldn't be "invalid" - that's covered by "required".
20
20
  if (viewValue === '') {
21
21
  return true;
22
22
  }
23
- // Check if the date is valid according to any of the given formats
24
- return validDateFormats.some(format => {
25
- const parsed = DateTime.fromFormat(viewValue, format);
26
- return parsed.isValid;
27
- });
23
+ return moment_1.default(viewValue, validDateFormats, true).isValid();
28
24
  };
29
25
  }
30
26
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"validate-date.js","sourceRoot":"","sources":["../../src/components/date-input/validate-date.js"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAErC,iBAAO,CAAC,MAA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gBAC5B,YAAY,EAAE,YAAY;gBAC1B,UAAU,EAAE,UAAU;gBACtB,UAAU,EAAE,UAAU;gBACtB,QAAQ,EAAE,QAAQ;aAClB,CAAC;YAEF,sEAAsE;YACtE,IAAI,SAAS,KAAK,EAAE,EAAE;gBACrB,OAAO,IAAI,CAAC;aACZ;YAED,OAAO,gBAAM,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QAC5D,CAAC,CAAC;IACH,CAAC;IAED,OAAO;QACN,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,IAAI;KACV,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const angular_1 = __importDefault(require("angular"));
7
7
  const lodash_1 = __importDefault(require("lodash"));
8
- const luxon_1 = require("luxon");
8
+ const moment_1 = __importDefault(require("moment"));
9
9
  angular_1.default.module('app').factory('dateTimeZoneFactory', function dateTimeZoneFactory() {
10
10
  const timeZones = [
11
11
  { value: -12, zone: 'IDLW - Internation Date Line West', display: 'IDLW' },
@@ -40,78 +40,65 @@ angular_1.default.module('app').factory('dateTimeZoneFactory', function dateTime
40
40
  { value: 11, zone: 'SBT - Solomon Islands Time', display: 'SBT' },
41
41
  { value: 12, zone: 'NZST - New Zealand Standard Time', display: 'NZST' }
42
42
  ];
43
- // using string validate on the datepicker gives us more control with luxon's parsing
43
+ // using string validate on the datepicker gives us more control w moment's loose parsing
44
44
  const validDateFormats = [
45
- // Full month name formats (MMMM)
46
- 'd-MMMM-yyyy',
47
- 'd-MM-yyyy',
48
- 'd-M-yyyy',
49
- 'MMMM-d-yyyy',
50
- 'MM-d-yyyy',
51
- 'M-d-yyyy',
52
- 'd/MMMM/yyyy',
53
- 'd/MM/yyyy',
54
- 'd/M/yyyy',
55
- 'MMMM/d/yyyy',
56
- 'MM/d/yyyy',
57
- 'M/d/yyyy',
58
- 'd.MMMM.yyyy',
59
- 'd.MM.yyyy',
60
- 'd.M.yyyy',
61
- 'MMMM.d.yyyy',
62
- 'MM.d.yyyy',
63
- 'M.d.yyyy',
64
- 'd-MMMM-yy',
65
- 'd-MM-yy',
66
- 'd-M-yy',
67
- 'MMMM-d-yy',
68
- 'MM-d-yy',
69
- 'M-d-yy',
70
- 'd/MMMM/yy',
71
- 'd/MM/yy',
72
- 'd/M/yy',
73
- 'MMMM/d/yy',
74
- 'MM/d/yy',
75
- 'M/d/yy',
76
- 'd.MMMM.yy',
77
- 'd.MM.yy',
78
- 'd.M.yy',
79
- 'MMMM.d.yy',
80
- 'MM.d.yy',
81
- 'M.d.yy',
82
- // Abbreviated month name formats (MMM)
83
- 'd-MMM-yyyy',
84
- 'MMM-d-yyyy',
85
- 'd/MMM/yyyy',
86
- 'MMM/d/yyyy',
87
- 'd.MMM.yyyy',
88
- 'MMM.d.yyyy',
89
- 'd-MMM-yy',
90
- 'MMM-d-yy',
91
- 'd/MMM/yy',
92
- 'MMM/d/yy',
93
- 'd.MMM.yy',
94
- 'MMM.d.yy'
45
+ 'D-MMMM-YYYY',
46
+ 'D-MM-YYYY',
47
+ 'D-M-YYYY',
48
+ 'MMMM-D-YYYY',
49
+ 'MM-D-YYYY',
50
+ 'M-D-YYYY',
51
+ 'D/MMMM/YYYY',
52
+ 'D/MM/YYYY',
53
+ 'D/M/YYYY',
54
+ 'MMMM/D/YYYY',
55
+ 'MM/D/YYYY',
56
+ 'M/D/YYYY',
57
+ 'D.MMMM.YYYY',
58
+ 'D.MM.YYYY',
59
+ 'D.M.YYYY',
60
+ 'MMMM.D.YYYY',
61
+ 'MM.D.YYYY',
62
+ 'M.D.YYYY',
63
+ 'D-MMMM-YY',
64
+ 'D-MM-YY',
65
+ 'D-M-YY',
66
+ 'MMMM-D-YY',
67
+ 'MM-D-YY',
68
+ 'M-D-YY',
69
+ 'D/MMMM/YY',
70
+ 'D/MM/YY',
71
+ 'D/M/YY',
72
+ 'MMMM/D/YY',
73
+ 'MM/D/YY',
74
+ 'M/D/YY',
75
+ 'D.MMMM.YY',
76
+ 'D.MM.YY',
77
+ 'D.M.YY',
78
+ 'MMMM.D.YY',
79
+ 'MM.D.YY',
80
+ 'M.D.YY'
95
81
  ];
96
82
  return {
97
83
  timeZones,
98
84
  validDateFormats,
99
- getTimeZone(dateTime) {
100
- if (dateTime && dateTime.isValid) {
85
+ getTimeZone(momentDate) {
86
+ if (momentDate.isValid()) {
101
87
  // Get the timezone offset in hours and adjust the sign
102
- let zoneOffset = dateTime.offset / 60;
88
+ let zoneOffset = (momentDate.utcOffset() / 60);
103
89
  // consider a shift for DST
104
- // create a fresh DateTime to check if DST is in effect
105
- const isDST = luxon_1.DateTime.fromISO(dateTime.toISO()).isInDST;
106
- // at this point zoneOffset is our true offset from UTC 0
107
- // so for example if we are UTC -6 AND we are DST, then our dateTime is really "Mountain Time" which is -7
90
+ // must use isDST on a frest moment object -
91
+ // the passed variable is parsedZone and thus will always return isDST false
92
+ const isDST = moment_1.default(momentDate.format()).isDST();
93
+ // at this point zoneOffest is our true offest from UTC 0
94
+ // so for example if we are UTC -6 AND we are DST, then our moment is really "Mountain Time" which is is -7
108
95
  // during the winter but is -6 during DST -- if we want to consistently show the label 'MST' for this date
109
- // we need to select -7 although the offset is -6 (or subtracting 1 from our actual utc output)
96
+ // we need to select -7 although the offset is -6 (or subtracting 1 from our actyual utc output)
110
97
  zoneOffset = (isDST) ? zoneOffset - 1 : zoneOffset;
111
98
  // NOTE: The above DST adjustment is somewhat arbitrary.
112
99
  // isDST() cannot be globally accurate as it works purely off a date and an offset.
113
- // No actual timezone information is used except for assumptions made from the users current locale.
114
- // Recommendation to switch to luxon's timezone handling in the future.
100
+ // No actual timezone information is used except for assumptins made from the users current locale.
101
+ // Recommendation to switch to moment's timezone.js in the future.
115
102
  return this.getTimeZoneByOffset(zoneOffset);
116
103
  }
117
104
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"date-time-zone-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AAQ;YAEnB,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE;gBAEjC,uDAAuD;gBACvD,IAAI,UAAU,GAAG,QAAQ,CAAC,MAAM,GAAG,EAAE,CAAA;gBAErC,2BAA2B;gBAC3B,uDAAuD;gBACvD,MAAM,KAAK,GAAG,gBAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,CAAA;gBAExD,yDAAyD;gBACzD,0GAA0G;gBAC1G,0GAA0G;gBAC1G,+FAA+F;gBAC/F,UAAU,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAA;gBAElD,wDAAwD;gBACxD,mFAAmF;gBACnF,oGAAoG;gBACpG,uEAAuE;gBAEvE,OAAO,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;aAC3C;YAED,OAAO,IAAI,CAAA;QACZ,CAAC;QAED,mBAAmB,CAAC,MAAM;YAEzB,OAAO,gBAAC,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;QAC5C,CAAC;KACD,CAAA;AACF,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"date-time-zone-factory.js","sourceRoot":"","sources":["../../src/components/date-time-zone-picker/date-time-zone-factory.ts"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,oDAAsB;AACtB,oDAA2B;AAE3B,iBAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,SAAS,mBAAmB;IAEhF,MAAM,SAAS,GAAG;QACjB,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,mCAAmC,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1E,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,KAAK,EAAE;QACjE,EAAE,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CAAA;QACZ,CAAC;QAED,mBAAmB,CAAC,MAAM;YAEzB,OAAO,gBAAC,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;QAC5C,CAAC;KACD,CAAA;AACF,CAAC,CAAC,CAAA"}
@@ -6,18 +6,18 @@
6
6
  input-id="{{ inputId }}"
7
7
  is-disabled="isDisabled"
8
8
  is-required="{{ isRequired }}"
9
- date-luxon="dateLuxon"
9
+ date-moment="dateMoment"
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' && dateLuxon && !isDisabled">
15
+ <div class="o-col-xs-7" ng-show="type === 'datetime' && dateMoment && !isDisabled">
16
16
  <mfly:time-picker
17
17
  input-id="{{ inputId }}Time"
18
- time-luxon="timeLuxon"
18
+ time-moment="timeMoment"
19
19
  ng-show="!isDisabled"
20
- on-time-change="updateTime(newTime)">
20
+ on-time-change="updateTime()">
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' && dateLuxon && isDisabled">
31
+ <div class="o-col-xs-7" ng-show="type === 'datetime' && dateMoment && isDisabled">
32
32
  <div class="pull-left disabled">
33
- <span>{{ parentLuxon.toFormat('hh:mm a') }} {{ (timeZone) ? timeZone.display : '' }}</span>
33
+ <span>{{ parentMoment.format('hh:mm a') }} {{ (timeZone) ? timeZone.display : '' }}</span>
34
34
  </div>
35
35
  </div>
36
36
  </div>
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const angular_1 = __importDefault(require("angular"));
7
- const luxon_1 = require("luxon");
7
+ const moment_1 = __importDefault(require("moment"));
8
8
  angular_1.default.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory', function mflyDateTimeZonePicker(dateTimeZoneFactory) {
9
9
  return {
10
10
  restrict: 'E',
@@ -19,166 +19,106 @@ angular_1.default.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZo
19
19
  },
20
20
  template: require('./date-time-zone-picker.html'),
21
21
  link($scope, _element, _attr, ngModelCtrl) {
22
- // Init function creates DateTime dates from our utc string provided by the API
23
- // These DateTime dates are bound to the datepicker and timepicker (the
24
- // timezone object is also created but is not a DateTime)
25
- // Each component only alters its respective DateTime date, then tells this
22
+ // Init function creates moment dates from our utc string provided by the API
23
+ // These moment dates are bound to the datepicker and timepicker (the
24
+ // timezone object is also created but is not a moment)
25
+ // Each component only alters its respective moment date, then tells this
26
26
  // component when a change is made
27
27
  // When a change is made, this component combines the 3 datetime elements
28
28
  // and sends a utc string back to the api
29
29
  // ------------------------------------------------------------------
30
- function initParentLuxonFromAPI(value) {
31
- // Create a base DateTime and bound copies for each child component.
32
- if (value instanceof Date) {
33
- $scope.parentLuxon = luxon_1.DateTime.fromJSDate(value);
34
- }
35
- else if (typeof value === 'string') {
36
- // Parse with setZone: true to preserve the offset from the string
37
- const dt = luxon_1.DateTime.fromISO(value, { setZone: true });
38
- // Calculate offset in hours (including minutes as decimal)
39
- const offset = dt.offset / 60;
40
- // Find the matching time zone object
41
- const matchedZone = dateTimeZoneFactory.getTimeZoneByOffset(offset);
42
- // If found, set the zone on the DateTime object
43
- if (matchedZone) {
44
- // Format offset as UTC±HH:MM for non-integer offsets
45
- const absOffset = Math.abs(matchedZone.value);
46
- const hours = Math.floor(absOffset);
47
- const minutes = Math.round((absOffset - hours) * 60);
48
- const sign = matchedZone.value >= 0 ? '+' : '-';
49
- const zoneString = minutes === 0
50
- ? `UTC${sign}${hours}`
51
- : `UTC${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;
52
- $scope.parentLuxon = dt.setZone(zoneString, { keepLocalTime: true });
53
- $scope.timeZone = matchedZone;
54
- }
55
- else {
56
- // Fallback: just use the parsed DateTime
57
- $scope.parentLuxon = dt;
58
- $scope.timeZone = null;
59
- }
60
- }
61
- else {
62
- throw new Error(`Invalid value type ${typeof value} (${value})`);
63
- }
64
- $scope.timeLuxon = luxon_1.DateTime.fromObject({ hour: $scope.parentLuxon.hour, minute: $scope.parentLuxon.minute, second: 0, millisecond: 0 });
65
- $scope.dateLuxon = luxon_1.DateTime.fromObject({ year: $scope.parentLuxon.year, month: $scope.parentLuxon.month, day: $scope.parentLuxon.day });
30
+ function initParentMomentFromAPI(value) {
31
+ // Create a base moment and bound copies for each child component.
32
+ $scope.parentMoment = moment_1.default.parseZone(value);
33
+ $scope.timeMoment = moment_1.default({ hour: $scope.parentMoment.hour(), minute: $scope.parentMoment.minute() });
34
+ $scope.dateMoment = moment_1.default({ year: $scope.parentMoment.year(), month: $scope.parentMoment.month(), date: $scope.parentMoment.date() });
35
+ // The timezone component takes a custom timezone object instead of
36
+ // a moment. The factory returns a timezone, adjusting for DST.
37
+ $scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentMoment);
66
38
  }
67
- function initParentLuxonFromDatePicker(newDate) {
39
+ function initParentMomentFromDatePicker(newDate) {
68
40
  // when selecting a date from null or for the first time we need to
69
- // initialize the parentLuxon
70
- $scope.parentLuxon = luxon_1.DateTime.now();
71
- // the dateLuxon is set by the datepicker, but we want to update the parent
72
- // luxon to have the same date
73
- $scope.parentLuxon = $scope.parentLuxon.set({
74
- month: newDate.month,
75
- year: newDate.year,
76
- day: newDate.day
77
- });
78
- // we then init the timeLuxon with a default of 12:00am
79
- $scope.timeLuxon = luxon_1.DateTime.fromFormat('12:00 AM', 'hh:mm a');
80
- // parent luxon will have the now, but should also initially have 12:00am
81
- $scope.parentLuxon = $scope.parentLuxon.set({
82
- hour: $scope.timeLuxon.hour,
83
- minute: $scope.timeLuxon.minute,
84
- second: 0,
85
- millisecond: 0,
86
- });
87
- // and init the time zone from the users's local time zone as we did in the initFromAPI function
88
- $scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentLuxon);
41
+ // initialize the parentMoment
42
+ $scope.parentMoment = moment_1.default();
43
+ // the dateMoment is set by the datepicker, but we want to update the parent
44
+ // moment to have the same date
45
+ $scope.parentMoment.month(newDate.month());
46
+ $scope.parentMoment.year(newDate.year());
47
+ $scope.parentMoment.date(newDate.date());
48
+ // we then init the timeMoment with a default of 12:00am
49
+ $scope.timeMoment = moment_1.default('12:00 AM', 'hh:mm A');
50
+ // parent moment will have the now, but should also inisially have 12:00am
51
+ $scope.parentMoment.hour($scope.timeMoment.hour());
52
+ $scope.parentMoment.minute($scope.timeMoment.minute());
53
+ // and init the time zone from the users's local time zone as we did in the initFromAPI funciton
54
+ $scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentMoment);
89
55
  }
90
56
  // Formatter runs when incoming values come from the model - this is
91
- // where we initialize our DateTime.
57
+ // where we initialize our moment.
92
58
  ngModelCtrl.$formatters.push(function (modelValue) {
93
59
  if (modelValue) {
94
- initParentLuxonFromAPI(modelValue);
60
+ initParentMomentFromAPI(modelValue);
95
61
  }
96
62
  else {
97
63
  // If we don't have a value, we should insure we clear the control
98
64
  // by passing NULL to the update function.
99
- $scope.dateLuxon = null;
65
+ $scope.dateMoment = null;
100
66
  }
101
67
  return modelValue;
102
68
  });
103
69
  ngModelCtrl.$parsers.push(function (modelValue) {
104
70
  return modelValue;
105
71
  });
106
- function updateAPIFromLuxon() {
107
- if ($scope.parentLuxon) {
108
- ngModelCtrl.$setViewValue($scope.parentLuxon.toISO());
72
+ function updateAPIFromMoment() {
73
+ if ($scope.parentMoment) {
74
+ ngModelCtrl.$setViewValue($scope.parentMoment.format());
109
75
  }
110
76
  else {
111
77
  ngModelCtrl.$setViewValue(null);
112
78
  }
113
79
  }
114
80
  $scope.updateDate = function (newDate) {
115
- // This is fired when the datepicker has updated the date portion of the DateTime
116
- // Update the parentLuxon with only the date change
81
+ // This is fired when the datepicker has updated the date portion of the moment
82
+ // Update the parentMoment with only the date change
117
83
  if (newDate) {
118
- // Update dateLuxon to reflect the new date (needed for template visibility)
119
- $scope.dateLuxon = newDate;
120
- if ($scope.parentLuxon) {
121
- // if we have a parent luxon update it
122
- $scope.parentLuxon = $scope.parentLuxon.set({
123
- month: newDate.month,
124
- year: newDate.year,
125
- day: newDate.day
126
- });
84
+ if ($scope.parentMoment) {
85
+ // if we have a parent moment update it
86
+ $scope.parentMoment.month(newDate.month());
87
+ $scope.parentMoment.year(newDate.year());
88
+ $scope.parentMoment.date(newDate.date());
127
89
  }
128
90
  else {
129
- // if we do not have a parent luxon b/c no previous date existed
130
- initParentLuxonFromDatePicker(newDate);
91
+ // if we do not have a parent moment b/c no previous date existed
92
+ initParentMomentFromDatePicker(newDate);
131
93
  }
132
94
  }
133
95
  else {
134
96
  // we are clearing out a date
135
- $scope.dateLuxon = null;
136
- $scope.parentLuxon = null;
97
+ $scope.parentMoment = '';
137
98
  }
138
- // changing between DST could alter our UTC offset
99
+ // changing between DST could alter our UTC offest
139
100
  // this adjustment happens in updateTimeZone which we can call here
140
- if ($scope.timeZone) {
141
- $scope.updateTimeZone($scope.timeZone.value);
142
- }
143
- updateAPIFromLuxon();
101
+ $scope.updateTimeZone($scope.timeZone.value);
144
102
  };
145
- $scope.updateTime = function (newTime) {
146
- // This is fired when the timepicker has updated the time portion of the DateTime
147
- // Update the parentLuxon with only the time change
148
- $scope.parentLuxon = $scope.parentLuxon.set({
149
- hour: newTime.hour,
150
- minute: newTime.minute,
151
- second: 0,
152
- millisecond: 0,
153
- });
154
- updateAPIFromLuxon();
103
+ $scope.updateTime = function () {
104
+ // This is fired when the timepicker has updated the time portion of the moment
105
+ // Update the parentMoment with only the time change
106
+ $scope.parentMoment.hour($scope.timeMoment.hour());
107
+ $scope.parentMoment.minute($scope.timeMoment.minute());
108
+ updateAPIFromMoment();
155
109
  };
156
110
  $scope.updateTimeZone = function (zoneOffset) {
157
- if ($scope.parentLuxon !== '') {
158
- // The zone offset displays with a dst offset (see date-time-zone-factory for details)
111
+ if ($scope.parentMoment !== '') {
112
+ // The zone offest displays with a dst offset (see date-time-zone-factory for details)
159
113
  // When we save back to the API we need to re-account for that offset
160
- // Create a DateTime to determine if we are dst
161
- const isDST = luxon_1.DateTime.fromISO($scope.parentLuxon.toISO()).isInDST;
114
+ // Create a moment to determine if we are dst
115
+ const isDST = moment_1.default($scope.parentMoment.format()).isDST();
162
116
  // adjust the zoneOffset passed from the UI if the date is dst
163
117
  zoneOffset = (isDST) ? zoneOffset + 1 : zoneOffset;
164
- // Convert fractional hours to HH:MM format for Luxon
165
- // Luxon expects UTC offsets in the format "UTC+HH:MM" or "UTC-HH:MM"
166
- const sign = zoneOffset >= 0 ? '+' : '-';
167
- const absOffset = Math.abs(zoneOffset);
168
- const hours = Math.floor(absOffset);
169
- const minutes = Math.round((absOffset - hours) * 60);
170
- let zoneString;
171
- if (minutes === 0) {
172
- // For whole hours, we can use the simple format like "UTC+3" or "UTC-5"
173
- zoneString = `UTC${sign}${hours}`;
174
- }
175
- else {
176
- // For fractional hours, we need the HH:MM format like "UTC+03:30" or "UTC-03:30"
177
- zoneString = `UTC${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`;
178
- }
179
- $scope.parentLuxon = $scope.parentLuxon.setZone(zoneString, { keepLocalTime: true });
118
+ // update the zone/offset change
119
+ $scope.parentMoment.utcOffset(zoneOffset, true);
180
120
  }
181
- updateAPIFromLuxon();
121
+ updateAPIFromMoment();
182
122
  };
183
123
  $scope.pickerOpened = function () {
184
124
  $scope.onOpen();