@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
@@ -1,5 +1,5 @@
1
1
  import angular from 'angular'
2
- const { DateTime } = require('luxon')
2
+ import moment from 'moment'
3
3
 
4
4
  angular.module('app').directive('mflyValidateDate', function mflyValidateDate () {
5
5
 
@@ -7,25 +7,21 @@ angular.module('app').directive('mflyValidateDate', function mflyValidateDate ()
7
7
 
8
8
  $ctrl.$validators.dateFormat = function (modelValue, viewValue) {
9
9
 
10
- var validDateFormats = [
11
- 'd-MMM-yyyy', 'd/MMM/yyyy',
12
- 'dd-MMM-yyyy', 'dd/MMM/yyyy',
13
- 'MM-dd-yyyy', 'MM/dd/yyyy',
14
- 'M-d-yyyy', 'M/d/yyyy',
15
- 'MM-dd-yy', 'MM/dd/yy',
16
- 'M-d-yy', 'M/d/yy'
17
- ];
10
+ var validDateFormats = [
11
+ 'D-MMM-YYYY', 'D/MMM/YYYY',
12
+ 'DD-MMM-YYYY', 'DD/MMM/YYYY',
13
+ 'MM-DD-YYYY', 'MM/DD/YYYY',
14
+ 'M-D-YYYY', 'M/D/YYYY',
15
+ 'MM-DD-YY', 'MM/DD/YY',
16
+ 'M-D-YY', 'M/D/YY'
17
+ ];
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
23
 
24
- // Check if the date is valid according to any of the given formats
25
- return validDateFormats.some(format => {
26
- const parsed = DateTime.fromFormat(viewValue, format)
27
- return parsed.isValid
28
- })
24
+ return moment(viewValue, validDateFormats, true).isValid();
29
25
  };
30
26
  }
31
27
 
@@ -1,6 +1,6 @@
1
1
  import angular from 'angular'
2
2
  import _ from 'lodash'
3
- import { DateTime } from 'luxon'
3
+ import moment from 'moment'
4
4
 
5
5
  angular.module('app').factory('dateTimeZoneFactory', function dateTimeZoneFactory() {
6
6
 
@@ -38,58 +38,44 @@ angular.module('app').factory('dateTimeZoneFactory', function dateTimeZoneFactor
38
38
  { value: 12, zone: 'NZST - New Zealand Standard Time', display: 'NZST' }
39
39
  ]
40
40
 
41
- // using string validate on the datepicker gives us more control with luxon's parsing
41
+ // using string validate on the datepicker gives us more control w moment's loose parsing
42
42
  const validDateFormats = [
43
- // Full month name formats (MMMM)
44
- 'd-MMMM-yyyy',
45
- 'd-MM-yyyy',
46
- 'd-M-yyyy',
47
- 'MMMM-d-yyyy',
48
- 'MM-d-yyyy',
49
- 'M-d-yyyy',
50
- 'd/MMMM/yyyy',
51
- 'd/MM/yyyy',
52
- 'd/M/yyyy',
53
- 'MMMM/d/yyyy',
54
- 'MM/d/yyyy',
55
- 'M/d/yyyy',
56
- 'd.MMMM.yyyy',
57
- 'd.MM.yyyy',
58
- 'd.M.yyyy',
59
- 'MMMM.d.yyyy',
60
- 'MM.d.yyyy',
61
- 'M.d.yyyy',
62
- 'd-MMMM-yy',
63
- 'd-MM-yy',
64
- 'd-M-yy',
65
- 'MMMM-d-yy',
66
- 'MM-d-yy',
67
- 'M-d-yy',
68
- 'd/MMMM/yy',
69
- 'd/MM/yy',
70
- 'd/M/yy',
71
- 'MMMM/d/yy',
72
- 'MM/d/yy',
73
- 'M/d/yy',
74
- 'd.MMMM.yy',
75
- 'd.MM.yy',
76
- 'd.M.yy',
77
- 'MMMM.d.yy',
78
- 'MM.d.yy',
79
- 'M.d.yy',
80
- // Abbreviated month name formats (MMM)
81
- 'd-MMM-yyyy',
82
- 'MMM-d-yyyy',
83
- 'd/MMM/yyyy',
84
- 'MMM/d/yyyy',
85
- 'd.MMM.yyyy',
86
- 'MMM.d.yyyy',
87
- 'd-MMM-yy',
88
- 'MMM-d-yy',
89
- 'd/MMM/yy',
90
- 'MMM/d/yy',
91
- 'd.MMM.yy',
92
- 'MMM.d.yy'
43
+ 'D-MMMM-YYYY',
44
+ 'D-MM-YYYY',
45
+ 'D-M-YYYY',
46
+ 'MMMM-D-YYYY',
47
+ 'MM-D-YYYY',
48
+ 'M-D-YYYY',
49
+ 'D/MMMM/YYYY',
50
+ 'D/MM/YYYY',
51
+ 'D/M/YYYY',
52
+ 'MMMM/D/YYYY',
53
+ 'MM/D/YYYY',
54
+ 'M/D/YYYY',
55
+ 'D.MMMM.YYYY',
56
+ 'D.MM.YYYY',
57
+ 'D.M.YYYY',
58
+ 'MMMM.D.YYYY',
59
+ 'MM.D.YYYY',
60
+ 'M.D.YYYY',
61
+ 'D-MMMM-YY',
62
+ 'D-MM-YY',
63
+ 'D-M-YY',
64
+ 'MMMM-D-YY',
65
+ 'MM-D-YY',
66
+ 'M-D-YY',
67
+ 'D/MMMM/YY',
68
+ 'D/MM/YY',
69
+ 'D/M/YY',
70
+ 'MMMM/D/YY',
71
+ 'MM/D/YY',
72
+ 'M/D/YY',
73
+ 'D.MMMM.YY',
74
+ 'D.MM.YY',
75
+ 'D.M.YY',
76
+ 'MMMM.D.YY',
77
+ 'MM.D.YY',
78
+ 'M.D.YY'
93
79
  ]
94
80
 
95
81
 
@@ -99,27 +85,28 @@ angular.module('app').factory('dateTimeZoneFactory', function dateTimeZoneFactor
99
85
 
100
86
  validDateFormats,
101
87
 
102
- getTimeZone(dateTime) {
88
+ getTimeZone(momentDate) {
103
89
 
104
- if (dateTime && dateTime.isValid) {
90
+ if (momentDate.isValid()) {
105
91
 
106
92
  // Get the timezone offset in hours and adjust the sign
107
- let zoneOffset = dateTime.offset / 60
93
+ let zoneOffset = (momentDate.utcOffset() / 60)
108
94
 
109
95
  // consider a shift for DST
110
- // create a fresh DateTime to check if DST is in effect
111
- const isDST = DateTime.fromISO(dateTime.toISO()).isInDST
96
+ // must use isDST on a frest moment object -
97
+ // the passed variable is parsedZone and thus will always return isDST false
98
+ const isDST = moment(momentDate.format()).isDST()
112
99
 
113
- // at this point zoneOffset is our true offset from UTC 0
114
- // so for example if we are UTC -6 AND we are DST, then our dateTime is really "Mountain Time" which is -7
100
+ // at this point zoneOffest is our true offest from UTC 0
101
+ // so for example if we are UTC -6 AND we are DST, then our moment is really "Mountain Time" which is is -7
115
102
  // during the winter but is -6 during DST -- if we want to consistently show the label 'MST' for this date
116
- // we need to select -7 although the offset is -6 (or subtracting 1 from our actual utc output)
103
+ // we need to select -7 although the offset is -6 (or subtracting 1 from our actyual utc output)
117
104
  zoneOffset = (isDST) ? zoneOffset - 1 : zoneOffset
118
105
 
119
106
  // NOTE: The above DST adjustment is somewhat arbitrary.
120
107
  // isDST() cannot be globally accurate as it works purely off a date and an offset.
121
- // No actual timezone information is used except for assumptions made from the users current locale.
122
- // Recommendation to switch to luxon's timezone handling in the future.
108
+ // No actual timezone information is used except for assumptins made from the users current locale.
109
+ // Recommendation to switch to moment's timezone.js in the future.
123
110
 
124
111
  return this.getTimeZoneByOffset(zoneOffset)
125
112
  }
@@ -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>
@@ -1,5 +1,5 @@
1
1
  import angular from 'angular'
2
- import { DateTime } from 'luxon'
2
+ import moment from 'moment'
3
3
 
4
4
  // This type is necessary because the directive link function expects something
5
5
  // conforming to ng.IController, but we want the types from ng.INgModelController
@@ -23,104 +23,73 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
23
23
  template: require('./date-time-zone-picker.html'),
24
24
  link($scope: ScopeKeyValuePair, _element, _attr, ngModelCtrl: PatchedNgModelController) {
25
25
 
26
- // Init function creates DateTime dates from our utc string provided by the API
27
- // These DateTime dates are bound to the datepicker and timepicker (the
28
- // timezone object is also created but is not a DateTime)
29
- // Each component only alters its respective DateTime date, then tells this
26
+ // Init function creates moment dates from our utc string provided by the API
27
+ // These moment dates are bound to the datepicker and timepicker (the
28
+ // timezone object is also created but is not a moment)
29
+ // Each component only alters its respective moment date, then tells this
30
30
  // component when a change is made
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 initParentLuxonFromAPI(value) {
35
-
36
- // Create a base DateTime and bound copies for each child component.
37
- if (value instanceof Date) {
38
- $scope.parentLuxon = DateTime.fromJSDate(value)
39
- } else if (typeof value === 'string') {
40
- // Parse with setZone: true to preserve the offset from the string
41
- const dt = DateTime.fromISO(value, { setZone: true })
42
- // Calculate offset in hours (including minutes as decimal)
43
- const offset = dt.offset / 60
44
- // Find the matching time zone object
45
- const matchedZone = dateTimeZoneFactory.getTimeZoneByOffset(offset)
46
- // If found, set the zone on the DateTime object
47
- if (matchedZone) {
48
- // Format offset as UTC±HH:MM for non-integer offsets
49
- const absOffset = Math.abs(matchedZone.value)
50
- const hours = Math.floor(absOffset)
51
- const minutes = Math.round((absOffset - hours) * 60)
52
- const sign = matchedZone.value >= 0 ? '+' : '-'
53
- const zoneString =
54
- minutes === 0
55
- ? `UTC${sign}${hours}`
56
- : `UTC${sign}${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}`
57
- $scope.parentLuxon = dt.setZone(zoneString, { keepLocalTime: true })
58
- $scope.timeZone = matchedZone
59
- } else {
60
- // Fallback: just use the parsed DateTime
61
- $scope.parentLuxon = dt
62
- $scope.timeZone = null
63
- }
64
- } else {
65
- throw new Error(`Invalid value type ${typeof value} (${value})`)
66
- }
34
+ function initParentMomentFromAPI(value) {
35
+
36
+ // Create a base moment and bound copies for each child component.
37
+ $scope.parentMoment = moment.parseZone(value)
38
+
39
+ $scope.timeMoment = moment({ hour: $scope.parentMoment.hour(), minute: $scope.parentMoment.minute() })
40
+ $scope.dateMoment = moment({ year: $scope.parentMoment.year(), month: $scope.parentMoment.month(), date: $scope.parentMoment.date() })
67
41
 
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 })
42
+ // The timezone component takes a custom timezone object instead of
43
+ // a moment. The factory returns a timezone, adjusting for DST.
44
+ $scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentMoment)
70
45
  }
71
46
 
72
- function initParentLuxonFromDatePicker(newDate) {
47
+ function initParentMomentFromDatePicker(newDate) {
73
48
  // when selecting a date from null or for the first time we need to
74
- // initialize the parentLuxon
75
- $scope.parentLuxon = DateTime.now()
76
-
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
- month: newDate.month,
81
- year: newDate.year,
82
- day: newDate.day
83
- })
84
-
85
- // we then init the timeLuxon with a default of 12:00am
86
- $scope.timeLuxon = DateTime.fromFormat('12:00 AM', 'hh:mm a')
87
-
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
- second: 0,
93
- millisecond: 0,
94
- })
95
-
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.parentLuxon)
49
+ // initialize the parentMoment
50
+ $scope.parentMoment = moment()
51
+
52
+ // the dateMoment is set by the datepicker, but we want to update the parent
53
+ // moment to have the same date
54
+ $scope.parentMoment.month(newDate.month())
55
+ $scope.parentMoment.year(newDate.year())
56
+ $scope.parentMoment.date(newDate.date())
57
+
58
+ // we then init the timeMoment with a default of 12:00am
59
+ $scope.timeMoment = moment('12:00 AM', 'hh:mm A')
60
+
61
+ // parent moment will have the now, but should also inisially have 12:00am
62
+ $scope.parentMoment.hour($scope.timeMoment.hour())
63
+ $scope.parentMoment.minute($scope.timeMoment.minute())
64
+
65
+ // and init the time zone from the users's local time zone as we did in the initFromAPI funciton
66
+ $scope.timeZone = dateTimeZoneFactory.getTimeZone($scope.parentMoment)
98
67
  }
99
68
 
100
69
  // Formatter runs when incoming values come from the model - this is
101
- // where we initialize our DateTime.
102
- ngModelCtrl.$formatters.push(function (modelValue) {
70
+ // where we initialize our moment.
71
+ ngModelCtrl.$formatters.push(function(modelValue) {
103
72
 
104
73
  if (modelValue) {
105
- initParentLuxonFromAPI(modelValue)
74
+ initParentMomentFromAPI(modelValue)
106
75
  }
107
76
  else {
108
77
  // If we don't have a value, we should insure we clear the control
109
78
  // by passing NULL to the update function.
110
- $scope.dateLuxon = null
79
+ $scope.dateMoment = null
111
80
  }
112
81
 
113
82
  return modelValue
114
83
  })
115
84
 
116
- ngModelCtrl.$parsers.push(function (modelValue) {
85
+ ngModelCtrl.$parsers.push(function(modelValue) {
117
86
  return modelValue
118
87
  })
119
88
 
120
- function updateAPIFromLuxon() {
89
+ function updateAPIFromMoment() {
121
90
 
122
- if ($scope.parentLuxon) {
123
- ngModelCtrl.$setViewValue($scope.parentLuxon.toISO())
91
+ if ($scope.parentMoment) {
92
+ ngModelCtrl.$setViewValue($scope.parentMoment.format())
124
93
  }
125
94
  else {
126
95
  ngModelCtrl.$setViewValue(null)
@@ -128,90 +97,60 @@ angular.module('app').directive('mflyDateTimeZonePicker', ['dateTimeZoneFactory'
128
97
  }
129
98
 
130
99
 
131
- $scope.updateDate = function (newDate) {
132
- // This is fired when the datepicker has updated the date portion of the DateTime
133
- // Update the parentLuxon with only the date change
100
+ $scope.updateDate = function(newDate) {
101
+ // This is fired when the datepicker has updated the date portion of the moment
102
+ // Update the parentMoment with only the date change
134
103
  if (newDate) {
135
- // Update dateLuxon to reflect the new date (needed for template visibility)
136
- $scope.dateLuxon = newDate
137
-
138
- if ($scope.parentLuxon) {
139
- // if we have a parent luxon update it
140
- $scope.parentLuxon = $scope.parentLuxon.set({
141
- month: newDate.month,
142
- year: newDate.year,
143
- day: newDate.day
144
- })
104
+ if ($scope.parentMoment) {
105
+ // if we have a parent moment update it
106
+ $scope.parentMoment.month(newDate.month())
107
+ $scope.parentMoment.year(newDate.year())
108
+ $scope.parentMoment.date(newDate.date())
145
109
  }
146
110
  else {
147
- // if we do not have a parent luxon b/c no previous date existed
148
- initParentLuxonFromDatePicker(newDate)
111
+ // if we do not have a parent moment b/c no previous date existed
112
+ initParentMomentFromDatePicker(newDate)
149
113
  }
150
114
  }
151
115
  else {
152
116
  // we are clearing out a date
153
- $scope.dateLuxon = null
154
- $scope.parentLuxon = null
117
+ $scope.parentMoment = ''
155
118
  }
156
119
 
157
- // changing between DST could alter our UTC offset
120
+ // changing between DST could alter our UTC offest
158
121
  // this adjustment happens in updateTimeZone which we can call here
159
- if ($scope.timeZone) {
160
- $scope.updateTimeZone($scope.timeZone.value)
161
- }
162
-
163
- updateAPIFromLuxon()
122
+ $scope.updateTimeZone($scope.timeZone.value)
164
123
  }
165
124
 
166
125
 
167
- $scope.updateTime = function (newTime) {
168
- // This is fired when the timepicker has updated the time portion of the DateTime
169
- // Update the parentLuxon with only the time change
170
- $scope.parentLuxon = $scope.parentLuxon.set({
171
- hour: newTime.hour,
172
- minute: newTime.minute,
173
- second: 0,
174
- millisecond: 0,
175
- })
126
+ $scope.updateTime = function() {
127
+ // This is fired when the timepicker has updated the time portion of the moment
128
+ // Update the parentMoment with only the time change
129
+ $scope.parentMoment.hour($scope.timeMoment.hour())
130
+ $scope.parentMoment.minute($scope.timeMoment.minute())
176
131
 
177
- updateAPIFromLuxon()
132
+ updateAPIFromMoment()
178
133
  }
179
134
 
180
- $scope.updateTimeZone = function (zoneOffset) {
135
+ $scope.updateTimeZone = function(zoneOffset) {
181
136
 
182
- if ($scope.parentLuxon !== '') {
137
+ if ($scope.parentMoment !== '') {
183
138
 
184
- // The zone offset displays with a dst offset (see date-time-zone-factory for details)
139
+ // The zone offest displays with a dst offset (see date-time-zone-factory for details)
185
140
  // When we save back to the API we need to re-account for that offset
186
- // Create a DateTime to determine if we are dst
187
- const isDST = DateTime.fromISO($scope.parentLuxon.toISO()).isInDST
141
+ // Create a moment to determine if we are dst
142
+ const isDST = moment($scope.parentMoment.format()).isDST()
188
143
 
189
144
  // adjust the zoneOffset passed from the UI if the date is dst
190
145
  zoneOffset = (isDST) ? zoneOffset + 1 : zoneOffset
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 })
146
+ // update the zone/offset change
147
+ $scope.parentMoment.utcOffset(zoneOffset, true)
209
148
  }
210
149
 
211
- updateAPIFromLuxon()
150
+ updateAPIFromMoment()
212
151
  }
213
152
 
214
- $scope.pickerOpened = function () {
153
+ $scope.pickerOpened = function() {
215
154
  $scope.onOpen()
216
155
  }
217
156
 
@@ -6,9 +6,10 @@
6
6
  autocomplete="off"
7
7
  class="o-form-control"
8
8
  id="{{ inputId }}"
9
- mfly-datepicker="luxonDate"
9
+ mfly-datepicker="momentDate"
10
10
  name="mflyDatepicker"
11
- ng-blur="onBlur()"
11
+ ng-blur="focusAddOn = false"
12
+ ng-change="validateDate()"
12
13
  ng-disabled="isDisabled"
13
14
  ng-focus="focusAddOn = true"
14
15
  ng-keydown="inputKeyDown($event)"