@mui/x-date-pickers 7.0.0-alpha.2 → 7.0.0-alpha.4

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 (242) hide show
  1. package/AdapterDateFns/AdapterDateFns.js +10 -14
  2. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +12 -16
  3. package/AdapterDayjs/AdapterDayjs.js +11 -8
  4. package/AdapterLuxon/AdapterLuxon.d.ts +28 -28
  5. package/AdapterLuxon/AdapterLuxon.js +29 -17
  6. package/AdapterMoment/AdapterMoment.d.ts +1 -1
  7. package/AdapterMoment/AdapterMoment.js +14 -14
  8. package/AdapterMomentHijri/AdapterMomentHijri.d.ts +0 -1
  9. package/AdapterMomentHijri/AdapterMomentHijri.js +1 -24
  10. package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +0 -2
  11. package/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -26
  12. package/CHANGELOG.md +364 -0
  13. package/DateCalendar/DateCalendar.js +2 -2
  14. package/DateCalendar/DayCalendar.d.ts +3 -3
  15. package/DateCalendar/useCalendarState.js +0 -1
  16. package/DatePicker/DatePicker.js +2 -2
  17. package/DateTimePicker/DateTimePicker.js +2 -2
  18. package/DesktopDatePicker/DesktopDatePicker.js +2 -2
  19. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  20. package/MobileDatePicker/MobileDatePicker.js +2 -2
  21. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  22. package/MonthCalendar/MonthCalendar.js +0 -1
  23. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +2 -0
  24. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +3 -2
  25. package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
  26. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
  27. package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
  28. package/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
  29. package/PickersShortcuts/PickersShortcuts.d.ts +1 -1
  30. package/PickersShortcuts/PickersShortcuts.js +1 -1
  31. package/README.md +0 -1
  32. package/StaticDatePicker/StaticDatePicker.js +2 -2
  33. package/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  34. package/TimeClock/Clock.js +0 -1
  35. package/TimeClock/ClockPointer.js +0 -1
  36. package/YearCalendar/YearCalendar.js +0 -1
  37. package/index.js +1 -1
  38. package/internals/components/PickersTextField/Outline.d.ts +8 -0
  39. package/internals/components/PickersTextField/Outline.js +97 -0
  40. package/internals/components/PickersTextField/PickersInput.d.ts +3 -0
  41. package/internals/components/PickersTextField/PickersInput.js +269 -0
  42. package/internals/components/PickersTextField/PickersInput.types.d.ts +45 -0
  43. package/internals/components/PickersTextField/PickersInput.types.js +1 -0
  44. package/internals/components/PickersTextField/PickersTextField.d.ts +3 -0
  45. package/internals/components/PickersTextField/PickersTextField.js +129 -0
  46. package/internals/components/PickersTextField/PickersTextField.types.d.ts +21 -0
  47. package/internals/components/PickersTextField/PickersTextField.types.js +1 -0
  48. package/internals/components/PickersTextField/index.d.ts +1 -0
  49. package/internals/components/PickersTextField/index.js +1 -0
  50. package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +46 -0
  51. package/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
  52. package/internals/constants/dimensions.d.ts +1 -1
  53. package/internals/constants/dimensions.js +1 -1
  54. package/internals/demo/DemoContainer.d.ts +4 -0
  55. package/internals/demo/DemoContainer.js +47 -19
  56. package/internals/hooks/useClockReferenceDate.js +0 -1
  57. package/internals/hooks/useField/useField.utils.js +23 -12
  58. package/internals/hooks/usePicker/usePickerValue.js +2 -6
  59. package/internals/hooks/usePicker/usePickerValue.types.d.ts +2 -2
  60. package/internals/hooks/useViews.js +0 -1
  61. package/legacy/AdapterDateFns/AdapterDateFns.js +10 -14
  62. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +12 -16
  63. package/legacy/AdapterDayjs/AdapterDayjs.js +11 -8
  64. package/legacy/AdapterLuxon/AdapterLuxon.js +30 -18
  65. package/legacy/AdapterMoment/AdapterMoment.js +326 -320
  66. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +4 -25
  67. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -30
  68. package/legacy/DateCalendar/DateCalendar.js +2 -2
  69. package/legacy/DateCalendar/useCalendarState.js +0 -1
  70. package/legacy/DatePicker/DatePicker.js +2 -2
  71. package/legacy/DateTimePicker/DateTimePicker.js +2 -2
  72. package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
  73. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  74. package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
  75. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  76. package/legacy/MonthCalendar/MonthCalendar.js +0 -1
  77. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +2 -0
  78. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
  79. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
  80. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
  81. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
  82. package/legacy/PickersShortcuts/PickersShortcuts.js +2 -1
  83. package/legacy/StaticDatePicker/StaticDatePicker.js +2 -2
  84. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  85. package/legacy/TimeClock/Clock.js +0 -1
  86. package/legacy/TimeClock/ClockPointer.js +0 -1
  87. package/legacy/YearCalendar/YearCalendar.js +0 -1
  88. package/legacy/index.js +1 -1
  89. package/legacy/internals/components/PickersTextField/Outline.js +97 -0
  90. package/legacy/internals/components/PickersTextField/PickersInput.js +277 -0
  91. package/legacy/internals/components/PickersTextField/PickersInput.types.js +1 -0
  92. package/legacy/internals/components/PickersTextField/PickersTextField.js +129 -0
  93. package/legacy/internals/components/PickersTextField/PickersTextField.types.js +1 -0
  94. package/legacy/internals/components/PickersTextField/index.js +1 -0
  95. package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
  96. package/legacy/internals/constants/dimensions.js +1 -1
  97. package/legacy/internals/demo/DemoContainer.js +45 -19
  98. package/legacy/internals/hooks/useClockReferenceDate.js +0 -1
  99. package/legacy/internals/hooks/useField/useField.utils.js +23 -12
  100. package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -6
  101. package/legacy/internals/hooks/useViews.js +0 -1
  102. package/legacy/locales/plPL.js +0 -1
  103. package/legacy/locales/svSE.js +0 -1
  104. package/legacy/locales/urPK.js +0 -1
  105. package/locales/beBY.d.ts +18 -5
  106. package/locales/caES.d.ts +18 -5
  107. package/locales/csCZ.d.ts +18 -5
  108. package/locales/daDK.d.ts +18 -5
  109. package/locales/deDE.d.ts +18 -5
  110. package/locales/elGR.d.ts +18 -5
  111. package/locales/enUS.d.ts +18 -5
  112. package/locales/esES.d.ts +18 -5
  113. package/locales/eu.d.ts +18 -5
  114. package/locales/faIR.d.ts +18 -5
  115. package/locales/fiFI.d.ts +18 -5
  116. package/locales/frFR.d.ts +18 -5
  117. package/locales/heIL.d.ts +18 -5
  118. package/locales/huHU.d.ts +18 -5
  119. package/locales/isIS.d.ts +18 -5
  120. package/locales/itIT.d.ts +18 -5
  121. package/locales/jaJP.d.ts +18 -5
  122. package/locales/koKR.d.ts +18 -5
  123. package/locales/kzKZ.d.ts +18 -5
  124. package/locales/mk.d.ts +18 -5
  125. package/locales/nbNO.d.ts +18 -5
  126. package/locales/nlNL.d.ts +18 -5
  127. package/locales/plPL.d.ts +18 -5
  128. package/locales/plPL.js +0 -1
  129. package/locales/ptBR.d.ts +18 -5
  130. package/locales/roRO.d.ts +18 -5
  131. package/locales/ruRU.d.ts +18 -5
  132. package/locales/skSK.d.ts +18 -5
  133. package/locales/svSE.d.ts +18 -5
  134. package/locales/svSE.js +0 -1
  135. package/locales/trTR.d.ts +18 -5
  136. package/locales/ukUA.d.ts +18 -5
  137. package/locales/urPK.d.ts +18 -5
  138. package/locales/urPK.js +0 -1
  139. package/locales/utils/getPickersLocalization.d.ts +18 -5
  140. package/locales/utils/pickersLocaleTextApi.d.ts +18 -5
  141. package/locales/viVN.d.ts +18 -5
  142. package/locales/zhCN.d.ts +18 -5
  143. package/locales/zhHK.d.ts +18 -5
  144. package/modern/AdapterDateFns/AdapterDateFns.js +10 -14
  145. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +12 -16
  146. package/modern/AdapterDayjs/AdapterDayjs.js +11 -8
  147. package/modern/AdapterLuxon/AdapterLuxon.js +28 -17
  148. package/modern/AdapterMoment/AdapterMoment.js +14 -14
  149. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -24
  150. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -26
  151. package/modern/DateCalendar/DateCalendar.js +2 -2
  152. package/modern/DateCalendar/useCalendarState.js +0 -1
  153. package/modern/DatePicker/DatePicker.js +2 -2
  154. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  155. package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -2
  156. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  157. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  158. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  159. package/modern/MonthCalendar/MonthCalendar.js +0 -1
  160. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +2 -0
  161. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
  162. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
  163. package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
  164. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
  165. package/modern/PickersShortcuts/PickersShortcuts.js +1 -1
  166. package/modern/StaticDatePicker/StaticDatePicker.js +2 -2
  167. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  168. package/modern/TimeClock/Clock.js +0 -1
  169. package/modern/TimeClock/ClockPointer.js +0 -1
  170. package/modern/YearCalendar/YearCalendar.js +0 -1
  171. package/modern/index.js +1 -1
  172. package/modern/internals/components/PickersTextField/Outline.js +97 -0
  173. package/modern/internals/components/PickersTextField/PickersInput.js +268 -0
  174. package/modern/internals/components/PickersTextField/PickersInput.types.js +1 -0
  175. package/modern/internals/components/PickersTextField/PickersTextField.js +129 -0
  176. package/modern/internals/components/PickersTextField/PickersTextField.types.js +1 -0
  177. package/modern/internals/components/PickersTextField/index.js +1 -0
  178. package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
  179. package/modern/internals/constants/dimensions.js +1 -1
  180. package/modern/internals/demo/DemoContainer.js +47 -19
  181. package/modern/internals/hooks/useClockReferenceDate.js +0 -1
  182. package/modern/internals/hooks/useField/useField.utils.js +23 -12
  183. package/modern/internals/hooks/usePicker/usePickerValue.js +2 -6
  184. package/modern/internals/hooks/useViews.js +0 -1
  185. package/modern/locales/plPL.js +0 -1
  186. package/modern/locales/svSE.js +0 -1
  187. package/modern/locales/urPK.js +0 -1
  188. package/node/AdapterDateFns/AdapterDateFns.js +10 -14
  189. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +12 -16
  190. package/node/AdapterDayjs/AdapterDayjs.js +10 -7
  191. package/node/AdapterLuxon/AdapterLuxon.js +28 -17
  192. package/node/AdapterMoment/AdapterMoment.js +14 -14
  193. package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -24
  194. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -26
  195. package/node/DateCalendar/DateCalendar.js +2 -2
  196. package/node/DateCalendar/useCalendarState.js +0 -1
  197. package/node/DatePicker/DatePicker.js +2 -2
  198. package/node/DateTimePicker/DateTimePicker.js +2 -2
  199. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
  200. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  201. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  202. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  203. package/node/MonthCalendar/MonthCalendar.js +0 -1
  204. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +2 -0
  205. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
  206. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
  207. package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
  208. package/node/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
  209. package/node/PickersShortcuts/PickersShortcuts.js +1 -1
  210. package/node/StaticDatePicker/StaticDatePicker.js +2 -2
  211. package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  212. package/node/TimeClock/Clock.js +0 -1
  213. package/node/TimeClock/ClockPointer.js +0 -1
  214. package/node/YearCalendar/YearCalendar.js +0 -1
  215. package/node/index.js +1 -1
  216. package/node/internals/components/PickersTextField/Outline.js +106 -0
  217. package/node/internals/components/PickersTextField/PickersInput.js +276 -0
  218. package/node/internals/components/PickersTextField/PickersInput.types.js +5 -0
  219. package/node/internals/components/PickersTextField/PickersTextField.js +137 -0
  220. package/node/internals/components/PickersTextField/PickersTextField.types.js +5 -0
  221. package/node/internals/components/PickersTextField/index.js +12 -0
  222. package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +17 -0
  223. package/node/internals/constants/dimensions.js +1 -1
  224. package/node/internals/demo/DemoContainer.js +47 -19
  225. package/node/internals/hooks/useClockReferenceDate.js +0 -1
  226. package/node/internals/hooks/useField/useField.utils.js +23 -12
  227. package/node/internals/hooks/usePicker/usePickerValue.js +2 -6
  228. package/node/internals/hooks/useViews.js +0 -1
  229. package/node/locales/plPL.js +0 -1
  230. package/node/locales/svSE.js +0 -1
  231. package/node/locales/urPK.js +0 -1
  232. package/package.json +5 -5
  233. package/internals/components/FakeTextField/FakeTextField.d.ts +0 -22
  234. package/internals/components/FakeTextField/FakeTextField.js +0 -44
  235. package/internals/components/FakeTextField/index.d.ts +0 -1
  236. package/internals/components/FakeTextField/index.js +0 -1
  237. package/legacy/internals/components/FakeTextField/FakeTextField.js +0 -49
  238. package/legacy/internals/components/FakeTextField/index.js +0 -1
  239. package/modern/internals/components/FakeTextField/FakeTextField.js +0 -44
  240. package/modern/internals/components/FakeTextField/index.js +0 -1
  241. package/node/internals/components/FakeTextField/FakeTextField.js +0 -52
  242. package/node/internals/components/FakeTextField/index.js +0 -12
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
3
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
5
  /* eslint-disable class-methods-use-this */
6
6
  import defaultMoment from 'moment';
7
7
  // From https://momentjs.com/docs/#/displaying/format/
@@ -150,327 +150,333 @@ var MISSING_TIMEZONE_PLUGIN = ['Missing timezone plugin', 'To be able to use tim
150
150
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
151
151
  * SOFTWARE.
152
152
  */
153
- export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
154
- var _this = this;
155
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
156
- locale = _ref.locale,
157
- formats = _ref.formats,
158
- instance = _ref.instance;
159
- _classCallCheck(this, AdapterMoment);
160
- this.isMUIAdapter = true;
161
- this.isTimezoneCompatible = true;
162
- this.lib = 'moment';
163
- this.moment = void 0;
164
- this.locale = void 0;
165
- this.formats = void 0;
166
- this.escapedCharacters = {
167
- start: '[',
168
- end: ']'
169
- };
170
- this.formatTokenMap = formatTokenMap;
171
- this.setLocaleToValue = function (value) {
172
- var expectedLocale = _this.getCurrentLocaleCode();
173
- if (expectedLocale === value.locale()) {
174
- return value;
175
- }
176
- return value.locale(expectedLocale);
177
- };
178
- this.hasTimezonePlugin = function () {
179
- return typeof _this.moment.tz !== 'undefined';
180
- };
181
- this.createSystemDate = function (value) {
182
- var parsedValue = _this.moment(value).local();
183
- if (_this.locale === undefined) {
184
- return parsedValue;
185
- }
186
- return parsedValue.locale(_this.locale);
187
- };
188
- this.createUTCDate = function (value) {
189
- var parsedValue = _this.moment.utc(value);
190
- if (_this.locale === undefined) {
191
- return parsedValue;
192
- }
193
- return parsedValue.locale(_this.locale);
194
- };
195
- this.createTZDate = function (value, timezone) {
196
- /* istanbul ignore next */
197
- if (!_this.hasTimezonePlugin()) {
198
- throw new Error(MISSING_TIMEZONE_PLUGIN);
199
- }
200
- var parsedValue = timezone === 'default' ? _this.moment(value) : _this.moment.tz(value, timezone);
201
- if (_this.locale === undefined) {
202
- return parsedValue;
203
- }
204
- return parsedValue.locale(_this.locale);
205
- };
206
- this.date = function (value) {
207
- var timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
208
- if (value === null) {
209
- return null;
210
- }
211
- if (timezone === 'UTC') {
212
- return _this.createUTCDate(value);
213
- }
214
- if (timezone === 'system' || timezone === 'default' && !_this.hasTimezonePlugin()) {
215
- return _this.createSystemDate(value);
216
- }
217
- return _this.createTZDate(value, timezone);
218
- };
219
- this.getInvalidDate = function () {
220
- return _this.moment(new Date('Invalid Date'));
221
- };
222
- this.getTimezone = function (value) {
223
- var _value$_z, _ref2, _this$moment$defaultZ;
224
- // @ts-ignore
225
- // eslint-disable-next-line no-underscore-dangle
226
- var zone = (_value$_z = value._z) == null ? void 0 : _value$_z.name;
227
- var defaultZone = value.isUTC() ? 'UTC' : 'system';
228
-
229
- // @ts-ignore
230
- return (_ref2 = zone != null ? zone : (_this$moment$defaultZ = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ.name) != null ? _ref2 : defaultZone;
231
- };
232
- this.setTimezone = function (value, timezone) {
233
- var _this$moment$defaultZ2, _this$moment$defaultZ3;
234
- if (_this.getTimezone(value) === timezone) {
235
- return value;
236
- }
237
- if (timezone === 'UTC') {
238
- return value.clone().utc();
239
- }
240
- if (timezone === 'system') {
241
- return value.clone().local();
242
- }
243
- if (!_this.hasTimezonePlugin()) {
153
+ export var AdapterMoment = /*#__PURE__*/function () {
154
+ function AdapterMoment() {
155
+ var _this = this;
156
+ var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
157
+ locale = _ref.locale,
158
+ formats = _ref.formats,
159
+ instance = _ref.instance;
160
+ _classCallCheck(this, AdapterMoment);
161
+ this.isMUIAdapter = true;
162
+ this.isTimezoneCompatible = true;
163
+ this.lib = 'moment';
164
+ this.moment = void 0;
165
+ this.locale = void 0;
166
+ this.formats = void 0;
167
+ this.escapedCharacters = {
168
+ start: '[',
169
+ end: ']'
170
+ };
171
+ this.formatTokenMap = formatTokenMap;
172
+ this.setLocaleToValue = function (value) {
173
+ var expectedLocale = _this.getCurrentLocaleCode();
174
+ if (expectedLocale === value.locale()) {
175
+ return value;
176
+ }
177
+ return value.locale(expectedLocale);
178
+ };
179
+ this.hasTimezonePlugin = function () {
180
+ return typeof _this.moment.tz !== 'undefined';
181
+ };
182
+ this.createSystemDate = function (value) {
183
+ var parsedValue = _this.moment(value).local();
184
+ if (_this.locale === undefined) {
185
+ return parsedValue;
186
+ }
187
+ return parsedValue.locale(_this.locale);
188
+ };
189
+ this.createUTCDate = function (value) {
190
+ var parsedValue = _this.moment.utc(value);
191
+ if (_this.locale === undefined) {
192
+ return parsedValue;
193
+ }
194
+ return parsedValue.locale(_this.locale);
195
+ };
196
+ this.createTZDate = function (value, timezone) {
244
197
  /* istanbul ignore next */
245
- if (timezone !== 'default') {
198
+ if (!_this.hasTimezonePlugin()) {
246
199
  throw new Error(MISSING_TIMEZONE_PLUGIN);
247
200
  }
248
- return value;
249
- }
250
- var cleanZone = timezone === 'default' ? // @ts-ignore
251
- (_this$moment$defaultZ2 = (_this$moment$defaultZ3 = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ3.name) != null ? _this$moment$defaultZ2 : 'system' : timezone;
252
- if (cleanZone === 'system') {
253
- return value.clone().local();
254
- }
255
- var newValue = value.clone();
256
- newValue.tz(cleanZone);
257
- return newValue;
258
- };
259
- this.toJsDate = function (value) {
260
- return value.toDate();
261
- };
262
- this.parse = function (value, format) {
263
- if (value === '') {
264
- return null;
265
- }
266
- if (_this.locale) {
267
- return _this.moment(value, format, _this.locale, true);
268
- }
269
- return _this.moment(value, format, true);
270
- };
271
- this.getCurrentLocaleCode = function () {
272
- return _this.locale || defaultMoment.locale();
273
- };
274
- this.is12HourCycleInCurrentLocale = function () {
275
- return /A|a/.test(defaultMoment.localeData(_this.getCurrentLocaleCode()).longDateFormat('LT'));
276
- };
277
- this.expandFormat = function (format) {
278
- // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
279
- var localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
280
- return format.match(localFormattingTokens).map(function (token) {
281
- var firstCharacter = token[0];
282
- if (firstCharacter === 'L' || firstCharacter === ';') {
283
- return defaultMoment.localeData(_this.getCurrentLocaleCode()).longDateFormat(token);
201
+ var parsedValue = timezone === 'default' ? _this.moment(value) : _this.moment.tz(value, timezone);
202
+ if (_this.locale === undefined) {
203
+ return parsedValue;
284
204
  }
285
- return token;
286
- }).join('');
287
- };
288
- this.isValid = function (value) {
289
- if (value == null) {
290
- return false;
291
- }
292
- return value.isValid();
293
- };
294
- this.format = function (value, formatKey) {
295
- return _this.formatByString(value, _this.formats[formatKey]);
296
- };
297
- this.formatByString = function (value, formatString) {
298
- var clonedDate = value.clone();
299
- clonedDate.locale(_this.getCurrentLocaleCode());
300
- return clonedDate.format(formatString);
301
- };
302
- this.formatNumber = function (numberToFormat) {
303
- return numberToFormat;
304
- };
305
- this.isEqual = function (value, comparing) {
306
- if (value === null && comparing === null) {
307
- return true;
308
- }
309
- if (value === null || comparing === null) {
310
- return false;
311
- }
312
- return value.isSame(comparing);
313
- };
314
- this.isSameYear = function (value, comparing) {
315
- return value.isSame(comparing, 'year');
316
- };
317
- this.isSameMonth = function (value, comparing) {
318
- return value.isSame(comparing, 'month');
319
- };
320
- this.isSameDay = function (value, comparing) {
321
- return value.isSame(comparing, 'day');
322
- };
323
- this.isSameHour = function (value, comparing) {
324
- return value.isSame(comparing, 'hour');
325
- };
326
- this.isAfter = function (value, comparing) {
327
- return value.isAfter(comparing);
328
- };
329
- this.isAfterYear = function (value, comparing) {
330
- return value.isAfter(comparing, 'year');
331
- };
332
- this.isAfterDay = function (value, comparing) {
333
- return value.isAfter(comparing, 'day');
334
- };
335
- this.isBefore = function (value, comparing) {
336
- return value.isBefore(comparing);
337
- };
338
- this.isBeforeYear = function (value, comparing) {
339
- return value.isBefore(comparing, 'year');
340
- };
341
- this.isBeforeDay = function (value, comparing) {
342
- return value.isBefore(comparing, 'day');
343
- };
344
- this.isWithinRange = function (value, _ref3) {
345
- var _ref4 = _slicedToArray(_ref3, 2),
346
- start = _ref4[0],
347
- end = _ref4[1];
348
- return value.isBetween(start, end, null, '[]');
349
- };
350
- this.startOfYear = function (value) {
351
- return value.clone().startOf('year');
352
- };
353
- this.startOfMonth = function (value) {
354
- return value.clone().startOf('month');
355
- };
356
- this.startOfWeek = function (value) {
357
- return value.clone().startOf('week');
358
- };
359
- this.startOfDay = function (value) {
360
- return value.clone().startOf('day');
361
- };
362
- this.endOfYear = function (value) {
363
- return value.clone().endOf('year');
364
- };
365
- this.endOfMonth = function (value) {
366
- return value.clone().endOf('month');
367
- };
368
- this.endOfWeek = function (value) {
369
- return value.clone().endOf('week');
370
- };
371
- this.endOfDay = function (value) {
372
- return value.clone().endOf('day');
373
- };
374
- this.addYears = function (value, amount) {
375
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'years') : value.clone().add(amount, 'years');
376
- };
377
- this.addMonths = function (value, amount) {
378
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'months') : value.clone().add(amount, 'months');
379
- };
380
- this.addWeeks = function (value, amount) {
381
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'weeks') : value.clone().add(amount, 'weeks');
382
- };
383
- this.addDays = function (value, amount) {
384
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'days') : value.clone().add(amount, 'days');
385
- };
386
- this.addHours = function (value, amount) {
387
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'hours') : value.clone().add(amount, 'hours');
388
- };
389
- this.addMinutes = function (value, amount) {
390
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'minutes') : value.clone().add(amount, 'minutes');
391
- };
392
- this.addSeconds = function (value, amount) {
393
- return amount < 0 ? value.clone().subtract(Math.abs(amount), 'seconds') : value.clone().add(amount, 'seconds');
394
- };
395
- this.getYear = function (value) {
396
- return value.get('year');
397
- };
398
- this.getMonth = function (value) {
399
- return value.get('month');
400
- };
401
- this.getDate = function (value) {
402
- return value.get('date');
403
- };
404
- this.getHours = function (value) {
405
- return value.get('hours');
406
- };
407
- this.getMinutes = function (value) {
408
- return value.get('minutes');
409
- };
410
- this.getSeconds = function (value) {
411
- return value.get('seconds');
412
- };
413
- this.getMilliseconds = function (value) {
414
- return value.get('milliseconds');
415
- };
416
- this.setYear = function (value, year) {
417
- return value.clone().year(year);
418
- };
419
- this.setMonth = function (value, month) {
420
- return value.clone().month(month);
421
- };
422
- this.setDate = function (value, date) {
423
- return value.clone().date(date);
424
- };
425
- this.setHours = function (value, hours) {
426
- return value.clone().hours(hours);
427
- };
428
- this.setMinutes = function (value, minutes) {
429
- return value.clone().minutes(minutes);
430
- };
431
- this.setSeconds = function (value, seconds) {
432
- return value.clone().seconds(seconds);
433
- };
434
- this.setMilliseconds = function (value, milliseconds) {
435
- return value.clone().milliseconds(milliseconds);
436
- };
437
- this.getDaysInMonth = function (value) {
438
- return value.daysInMonth();
439
- };
440
- this.getWeekArray = function (value) {
441
- var cleanValue = _this.setLocaleToValue(value);
442
- var start = cleanValue.clone().startOf('month').startOf('week');
443
- var end = cleanValue.clone().endOf('month').endOf('week');
444
- var count = 0;
445
- var current = start;
446
- var nestedWeeks = [];
447
- while (current.isBefore(end)) {
448
- var weekNumber = Math.floor(count / 7);
449
- nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
450
- nestedWeeks[weekNumber].push(current);
451
- current = current.clone().add(1, 'day');
452
- count += 1;
453
- }
454
- return nestedWeeks;
455
- };
456
- this.getWeekNumber = function (value) {
457
- return value.week();
458
- };
459
- this.getYearRange = function (_ref5) {
460
- var _ref6 = _slicedToArray(_ref5, 2),
461
- start = _ref6[0],
462
- end = _ref6[1];
463
- var startDate = _this.moment(start).startOf('year');
464
- var endDate = _this.moment(end).endOf('year');
465
- var years = [];
466
- var current = startDate;
467
- while (current.isBefore(endDate)) {
468
- years.push(current);
469
- current = current.clone().add(1, 'year');
205
+ return parsedValue.locale(_this.locale);
206
+ };
207
+ this.date = function (value) {
208
+ var timezone = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
209
+ if (value === null) {
210
+ return null;
211
+ }
212
+ if (timezone === 'UTC') {
213
+ return _this.createUTCDate(value);
214
+ }
215
+ if (timezone === 'system' || timezone === 'default' && !_this.hasTimezonePlugin()) {
216
+ return _this.createSystemDate(value);
217
+ }
218
+ return _this.createTZDate(value, timezone);
219
+ };
220
+ this.getInvalidDate = function () {
221
+ return _this.moment(new Date('Invalid Date'));
222
+ };
223
+ this.getTimezone = function (value) {
224
+ var _value$_z, _ref2, _this$moment$defaultZ;
225
+ // @ts-ignore
226
+ // eslint-disable-next-line no-underscore-dangle
227
+ var zone = (_value$_z = value._z) == null ? void 0 : _value$_z.name;
228
+ var defaultZone = value.isUTC() ? 'UTC' : 'system';
229
+
230
+ // @ts-ignore
231
+ return (_ref2 = zone != null ? zone : (_this$moment$defaultZ = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ.name) != null ? _ref2 : defaultZone;
232
+ };
233
+ this.setTimezone = function (value, timezone) {
234
+ var _this$moment$defaultZ2, _this$moment$defaultZ3;
235
+ if (_this.getTimezone(value) === timezone) {
236
+ return value;
237
+ }
238
+ if (timezone === 'UTC') {
239
+ return value.clone().utc();
240
+ }
241
+ if (timezone === 'system') {
242
+ return value.clone().local();
243
+ }
244
+ if (!_this.hasTimezonePlugin()) {
245
+ /* istanbul ignore next */
246
+ if (timezone !== 'default') {
247
+ throw new Error(MISSING_TIMEZONE_PLUGIN);
248
+ }
249
+ return value;
250
+ }
251
+ var cleanZone = timezone === 'default' ? // @ts-ignore
252
+ (_this$moment$defaultZ2 = (_this$moment$defaultZ3 = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ3.name) != null ? _this$moment$defaultZ2 : 'system' : timezone;
253
+ if (cleanZone === 'system') {
254
+ return value.clone().local();
255
+ }
256
+ var newValue = value.clone();
257
+ newValue.tz(cleanZone);
258
+ return newValue;
259
+ };
260
+ this.toJsDate = function (value) {
261
+ return value.toDate();
262
+ };
263
+ this.parse = function (value, format) {
264
+ if (value === '') {
265
+ return null;
266
+ }
267
+ if (_this.locale) {
268
+ return _this.moment(value, format, _this.locale, true);
269
+ }
270
+ return _this.moment(value, format, true);
271
+ };
272
+ this.getCurrentLocaleCode = function () {
273
+ return _this.locale || defaultMoment.locale();
274
+ };
275
+ this.is12HourCycleInCurrentLocale = function () {
276
+ return /A|a/.test(defaultMoment.localeData(_this.getCurrentLocaleCode()).longDateFormat('LT'));
277
+ };
278
+ this.expandFormat = function (format) {
279
+ // @see https://github.com/moment/moment/blob/develop/src/lib/format/format.js#L6
280
+ var localFormattingTokens = /(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g;
281
+ return format.match(localFormattingTokens).map(function (token) {
282
+ var firstCharacter = token[0];
283
+ if (firstCharacter === 'L' || firstCharacter === ';') {
284
+ return defaultMoment.localeData(_this.getCurrentLocaleCode()).longDateFormat(token);
285
+ }
286
+ return token;
287
+ }).join('');
288
+ };
289
+ this.isValid = function (value) {
290
+ if (value == null) {
291
+ return false;
292
+ }
293
+ return value.isValid();
294
+ };
295
+ this.format = function (value, formatKey) {
296
+ return _this.formatByString(value, _this.formats[formatKey]);
297
+ };
298
+ this.formatByString = function (value, formatString) {
299
+ var clonedDate = value.clone();
300
+ clonedDate.locale(_this.getCurrentLocaleCode());
301
+ return clonedDate.format(formatString);
302
+ };
303
+ this.formatNumber = function (numberToFormat) {
304
+ return numberToFormat;
305
+ };
306
+ this.isEqual = function (value, comparing) {
307
+ if (value === null && comparing === null) {
308
+ return true;
309
+ }
310
+ if (value === null || comparing === null) {
311
+ return false;
312
+ }
313
+ return value.isSame(comparing);
314
+ };
315
+ this.isSameYear = function (value, comparing) {
316
+ return value.isSame(comparing, 'year');
317
+ };
318
+ this.isSameMonth = function (value, comparing) {
319
+ return value.isSame(comparing, 'month');
320
+ };
321
+ this.isSameDay = function (value, comparing) {
322
+ return value.isSame(comparing, 'day');
323
+ };
324
+ this.isSameHour = function (value, comparing) {
325
+ return value.isSame(comparing, 'hour');
326
+ };
327
+ this.isAfter = function (value, comparing) {
328
+ return value.isAfter(comparing);
329
+ };
330
+ this.isAfterYear = function (value, comparing) {
331
+ return value.isAfter(comparing, 'year');
332
+ };
333
+ this.isAfterDay = function (value, comparing) {
334
+ return value.isAfter(comparing, 'day');
335
+ };
336
+ this.isBefore = function (value, comparing) {
337
+ return value.isBefore(comparing);
338
+ };
339
+ this.isBeforeYear = function (value, comparing) {
340
+ return value.isBefore(comparing, 'year');
341
+ };
342
+ this.isBeforeDay = function (value, comparing) {
343
+ return value.isBefore(comparing, 'day');
344
+ };
345
+ this.isWithinRange = function (value, _ref3) {
346
+ var _ref4 = _slicedToArray(_ref3, 2),
347
+ start = _ref4[0],
348
+ end = _ref4[1];
349
+ return value.isBetween(start, end, null, '[]');
350
+ };
351
+ this.startOfYear = function (value) {
352
+ return value.clone().startOf('year');
353
+ };
354
+ this.startOfMonth = function (value) {
355
+ return value.clone().startOf('month');
356
+ };
357
+ this.startOfWeek = function (value) {
358
+ return value.clone().startOf('week');
359
+ };
360
+ this.startOfDay = function (value) {
361
+ return value.clone().startOf('day');
362
+ };
363
+ this.endOfYear = function (value) {
364
+ return value.clone().endOf('year');
365
+ };
366
+ this.endOfMonth = function (value) {
367
+ return value.clone().endOf('month');
368
+ };
369
+ this.endOfWeek = function (value) {
370
+ return value.clone().endOf('week');
371
+ };
372
+ this.endOfDay = function (value) {
373
+ return value.clone().endOf('day');
374
+ };
375
+ this.addYears = function (value, amount) {
376
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'years') : value.clone().add(amount, 'years');
377
+ };
378
+ this.addMonths = function (value, amount) {
379
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'months') : value.clone().add(amount, 'months');
380
+ };
381
+ this.addWeeks = function (value, amount) {
382
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'weeks') : value.clone().add(amount, 'weeks');
383
+ };
384
+ this.addDays = function (value, amount) {
385
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'days') : value.clone().add(amount, 'days');
386
+ };
387
+ this.addHours = function (value, amount) {
388
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'hours') : value.clone().add(amount, 'hours');
389
+ };
390
+ this.addMinutes = function (value, amount) {
391
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'minutes') : value.clone().add(amount, 'minutes');
392
+ };
393
+ this.addSeconds = function (value, amount) {
394
+ return amount < 0 ? value.clone().subtract(Math.abs(amount), 'seconds') : value.clone().add(amount, 'seconds');
395
+ };
396
+ this.getYear = function (value) {
397
+ return value.get('year');
398
+ };
399
+ this.getMonth = function (value) {
400
+ return value.get('month');
401
+ };
402
+ this.getDate = function (value) {
403
+ return value.get('date');
404
+ };
405
+ this.getHours = function (value) {
406
+ return value.get('hours');
407
+ };
408
+ this.getMinutes = function (value) {
409
+ return value.get('minutes');
410
+ };
411
+ this.getSeconds = function (value) {
412
+ return value.get('seconds');
413
+ };
414
+ this.getMilliseconds = function (value) {
415
+ return value.get('milliseconds');
416
+ };
417
+ this.setYear = function (value, year) {
418
+ return value.clone().year(year);
419
+ };
420
+ this.setMonth = function (value, month) {
421
+ return value.clone().month(month);
422
+ };
423
+ this.setDate = function (value, date) {
424
+ return value.clone().date(date);
425
+ };
426
+ this.setHours = function (value, hours) {
427
+ return value.clone().hours(hours);
428
+ };
429
+ this.setMinutes = function (value, minutes) {
430
+ return value.clone().minutes(minutes);
431
+ };
432
+ this.setSeconds = function (value, seconds) {
433
+ return value.clone().seconds(seconds);
434
+ };
435
+ this.setMilliseconds = function (value, milliseconds) {
436
+ return value.clone().milliseconds(milliseconds);
437
+ };
438
+ this.getDaysInMonth = function (value) {
439
+ return value.daysInMonth();
440
+ };
441
+ this.getWeekArray = function (value) {
442
+ var cleanValue = _this.setLocaleToValue(value);
443
+ var start = _this.startOfWeek(_this.startOfMonth(cleanValue));
444
+ var end = _this.endOfWeek(_this.endOfMonth(cleanValue));
445
+ var count = 0;
446
+ var current = start;
447
+ var nestedWeeks = [];
448
+ while (current.isBefore(end)) {
449
+ var weekNumber = Math.floor(count / 7);
450
+ nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
451
+ nestedWeeks[weekNumber].push(current);
452
+ current = _this.addDays(current, 1);
453
+ count += 1;
454
+ }
455
+ return nestedWeeks;
456
+ };
457
+ this.getWeekNumber = function (value) {
458
+ return value.week();
459
+ };
460
+ this.moment = instance || defaultMoment;
461
+ this.locale = locale;
462
+ this.formats = _extends({}, defaultFormats, formats);
463
+ }
464
+ _createClass(AdapterMoment, [{
465
+ key: "getYearRange",
466
+ value: function getYearRange(_ref5) {
467
+ var _ref6 = _slicedToArray(_ref5, 2),
468
+ start = _ref6[0],
469
+ end = _ref6[1];
470
+ var startDate = this.startOfYear(start);
471
+ var endDate = this.endOfYear(end);
472
+ var years = [];
473
+ var current = startDate;
474
+ while (this.isBefore(current, endDate)) {
475
+ years.push(current);
476
+ current = this.addYears(current, 1);
477
+ }
478
+ return years;
470
479
  }
471
- return years;
472
- };
473
- this.moment = instance || defaultMoment;
474
- this.locale = locale;
475
- this.formats = _extends({}, defaultFormats, formats);
476
- });
480
+ }]);
481
+ return AdapterMoment;
482
+ }();