@anglr/datetime 2.0.1 → 3.0.0-beta.20220322070853
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +86 -0
- package/date-fns/src/misc/tokens.d.ts.map +1 -1
- package/date-fns/src/services/dateFnsDateApi.service.d.ts.map +1 -1
- package/es2015/date-fns/src/misc/tokens.js +12 -1
- package/es2015/date-fns/src/misc/tokens.js.map +1 -1
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js +99 -5
- package/es2015/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2015/moment/src/misc/tokens.js +12 -1
- package/es2015/moment/src/misc/tokens.js.map +1 -1
- package/es2015/moment/src/services/momentDateApi.service.js +90 -0
- package/es2015/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2015/src/misc/datetime.interface.js.map +1 -1
- package/es2015/src/misc/tokens.js +12 -1
- package/es2015/src/misc/tokens.js.map +1 -1
- package/es2015/src/modules/datePipes.module.js +2 -7
- package/es2015/src/modules/datePipes.module.js.map +1 -1
- package/es2015/src/picker/components/clockTimePicker/clockTimePicker.component.js +14 -0
- package/es2015/src/picker/components/clockTimePicker/clockTimePicker.component.js.map +1 -0
- package/es2015/src/picker/components/clockTimePicker/clockTimePicker.interface.js +2 -0
- package/es2015/src/picker/components/clockTimePicker/clockTimePicker.interface.js.map +1 -0
- package/es2015/src/picker/components/dayPicker/dayPicker.component.js +49 -13
- package/es2015/src/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2015/src/picker/components/monthPicker/monthPicker.component.js +5 -4
- package/es2015/src/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2015/src/picker/components/picker/picker.component.js +3 -2
- package/es2015/src/picker/components/picker/picker.component.js.map +1 -1
- package/es2015/src/picker/components/pickerBase.component.js +15 -120
- package/es2015/src/picker/components/pickerBase.component.js.map +1 -1
- package/es2015/src/picker/components/pickerImplBase.component.js +145 -0
- package/es2015/src/picker/components/pickerImplBase.component.js.map +1 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.component.js +144 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.data.js +341 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.data.js.map +1 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.interface.js +2 -0
- package/es2015/src/picker/components/rollerTimePicker/rollerTimePicker.interface.js.map +1 -0
- package/es2015/src/picker/components/yearPicker/yearPicker.component.js +5 -4
- package/es2015/src/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2015/src/picker/directives/index.js +4 -0
- package/es2015/src/picker/directives/index.js.map +1 -0
- package/es2015/src/picker/directives/loopScroll/loopScroll.directive.js +200 -0
- package/es2015/src/picker/directives/loopScroll/loopScroll.directive.js.map +1 -0
- package/es2015/src/picker/directives/loopScroll/loopScroll.interface.js +3 -0
- package/es2015/src/picker/directives/loopScroll/loopScroll.interface.js.map +1 -0
- package/es2015/src/picker/directives/loopScrollData/loopScrollData.directive.js +23 -0
- package/es2015/src/picker/directives/loopScrollData/loopScrollData.directive.js.map +1 -0
- package/es2015/src/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2015/src/picker/modules/picker.module.js +21 -4
- package/es2015/src/picker/modules/picker.module.js.map +1 -1
- package/es2015/src/selector/components/inputDateTime/inputDateTime.component.js +16 -2
- package/es2015/src/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
- package/es2015/src/selector/components/selector/selector.component.js +25 -12
- package/es2015/src/selector/components/selector/selector.component.js.map +1 -1
- package/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +6 -2
- package/es2015/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
- package/es2015/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js +134 -0
- package/es2015/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js.map +1 -0
- package/es2015/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js.map +1 -1
- package/es2015/src/selector/misc/datetimeSelector.interface.js.map +1 -1
- package/es2015/src/selector/misc/tokens.js.map +1 -1
- package/es2015/src/selector/modules/selector.module.js +9 -4
- package/es2015/src/selector/modules/selector.module.js.map +1 -1
- package/es2015/src/services/dateApi.interface.js.map +1 -1
- package/es2015/src/services/datePositionParser.service.js +14 -0
- package/es2015/src/services/datePositionParser.service.js.map +1 -1
- package/es2015/src/services/dateTimeRelativeParser.service.js +15 -1
- package/es2015/src/services/dateTimeRelativeParser.service.js.map +1 -1
- package/es2015/src/services/dateValueProvider.service.js +10 -5
- package/es2015/src/services/dateValueProvider.service.js.map +1 -1
- package/es2015/src/services/formatProvider.interface.js.map +1 -1
- package/es2020/date-fns/src/misc/tokens.js +12 -1
- package/es2020/date-fns/src/misc/tokens.js.map +1 -1
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js +99 -5
- package/es2020/date-fns/src/services/dateFnsDateApi.service.js.map +1 -1
- package/es2020/moment/src/misc/tokens.js +12 -1
- package/es2020/moment/src/misc/tokens.js.map +1 -1
- package/es2020/moment/src/services/momentDateApi.service.js +90 -0
- package/es2020/moment/src/services/momentDateApi.service.js.map +1 -1
- package/es2020/src/misc/datetime.interface.js.map +1 -1
- package/es2020/src/misc/tokens.js +12 -1
- package/es2020/src/misc/tokens.js.map +1 -1
- package/es2020/src/modules/datePipes.module.js +2 -7
- package/es2020/src/modules/datePipes.module.js.map +1 -1
- package/es2020/src/picker/components/clockTimePicker/clockTimePicker.component.js +14 -0
- package/es2020/src/picker/components/clockTimePicker/clockTimePicker.component.js.map +1 -0
- package/es2020/src/picker/components/clockTimePicker/clockTimePicker.interface.js +2 -0
- package/es2020/src/picker/components/clockTimePicker/clockTimePicker.interface.js.map +1 -0
- package/es2020/src/picker/components/dayPicker/dayPicker.component.js +49 -13
- package/es2020/src/picker/components/dayPicker/dayPicker.component.js.map +1 -1
- package/es2020/src/picker/components/monthPicker/monthPicker.component.js +5 -4
- package/es2020/src/picker/components/monthPicker/monthPicker.component.js.map +1 -1
- package/es2020/src/picker/components/picker/picker.component.js +3 -2
- package/es2020/src/picker/components/picker/picker.component.js.map +1 -1
- package/es2020/src/picker/components/pickerBase.component.js +15 -120
- package/es2020/src/picker/components/pickerBase.component.js.map +1 -1
- package/es2020/src/picker/components/pickerImplBase.component.js +145 -0
- package/es2020/src/picker/components/pickerImplBase.component.js.map +1 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.component.js +138 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.component.js.map +1 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.data.js +341 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.data.js.map +1 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.interface.js +2 -0
- package/es2020/src/picker/components/rollerTimePicker/rollerTimePicker.interface.js.map +1 -0
- package/es2020/src/picker/components/yearPicker/yearPicker.component.js +5 -4
- package/es2020/src/picker/components/yearPicker/yearPicker.component.js.map +1 -1
- package/es2020/src/picker/directives/index.js +4 -0
- package/es2020/src/picker/directives/index.js.map +1 -0
- package/es2020/src/picker/directives/loopScroll/loopScroll.directive.js +191 -0
- package/es2020/src/picker/directives/loopScroll/loopScroll.directive.js.map +1 -0
- package/es2020/src/picker/directives/loopScroll/loopScroll.interface.js +3 -0
- package/es2020/src/picker/directives/loopScroll/loopScroll.interface.js.map +1 -0
- package/es2020/src/picker/directives/loopScrollData/loopScrollData.directive.js +23 -0
- package/es2020/src/picker/directives/loopScrollData/loopScrollData.directive.js.map +1 -0
- package/es2020/src/picker/misc/datetimePicker.interface.js.map +1 -1
- package/es2020/src/picker/modules/picker.module.js +21 -4
- package/es2020/src/picker/modules/picker.module.js.map +1 -1
- package/es2020/src/selector/components/inputDateTime/inputDateTime.component.js +16 -2
- package/es2020/src/selector/components/inputDateTime/inputDateTime.component.js.map +1 -1
- package/es2020/src/selector/components/selector/selector.component.js +22 -11
- package/es2020/src/selector/components/selector/selector.component.js.map +1 -1
- package/es2020/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js +6 -2
- package/es2020/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.js.map +1 -1
- package/es2020/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js +133 -0
- package/es2020/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.js.map +1 -0
- package/es2020/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.js.map +1 -1
- package/es2020/src/selector/misc/datetimeSelector.interface.js.map +1 -1
- package/es2020/src/selector/misc/tokens.js.map +1 -1
- package/es2020/src/selector/modules/selector.module.js +9 -4
- package/es2020/src/selector/modules/selector.module.js.map +1 -1
- package/es2020/src/services/dateApi.interface.js.map +1 -1
- package/es2020/src/services/datePositionParser.service.js +14 -0
- package/es2020/src/services/datePositionParser.service.js.map +1 -1
- package/es2020/src/services/dateTimeRelativeParser.service.js +15 -1
- package/es2020/src/services/dateTimeRelativeParser.service.js.map +1 -1
- package/es2020/src/services/dateValueProvider.service.js +10 -5
- package/es2020/src/services/dateValueProvider.service.js.map +1 -1
- package/es2020/src/services/formatProvider.interface.js.map +1 -1
- package/moment/src/misc/tokens.d.ts.map +1 -1
- package/moment/src/services/momentDateApi.service.d.ts.map +1 -1
- package/package.json +14 -16
- package/src/dark.scss +31 -28
- package/src/misc/datetime.interface.d.ts +1 -1
- package/src/misc/datetime.interface.d.ts.map +1 -1
- package/src/misc/tokens.d.ts.map +1 -1
- package/src/modules/datePipes.module.d.ts +3 -4
- package/src/modules/datePipes.module.d.ts.map +1 -1
- package/src/picker/components/clockTimePicker/clockTimePicker.component.css +0 -0
- package/src/picker/components/clockTimePicker/clockTimePicker.component.d.ts +9 -0
- package/src/picker/components/clockTimePicker/clockTimePicker.component.d.ts.map +1 -0
- package/src/picker/components/clockTimePicker/clockTimePicker.component.html +0 -0
- package/src/picker/components/clockTimePicker/clockTimePicker.interface.d.ts +6 -0
- package/src/picker/components/clockTimePicker/clockTimePicker.interface.d.ts.map +1 -0
- package/src/picker/components/dayPicker/dayPicker.component.d.ts +6 -0
- package/src/picker/components/dayPicker/dayPicker.component.d.ts.map +1 -1
- package/src/picker/components/dayPicker/dayPicker.component.html +11 -7
- package/src/picker/components/monthPicker/monthPicker.component.d.ts.map +1 -1
- package/src/picker/components/monthPicker/monthPicker.component.html +6 -6
- package/src/picker/components/picker/picker.component.css +4 -0
- package/src/picker/components/picker/picker.component.d.ts +3 -3
- package/src/picker/components/picker/picker.component.d.ts.map +1 -1
- package/src/picker/components/pickerBase.component.d.ts +7 -97
- package/src/picker/components/pickerBase.component.d.ts.map +1 -1
- package/src/picker/components/pickerImplBase.component.d.ts +128 -0
- package/src/picker/components/pickerImplBase.component.d.ts.map +1 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.component.css +40 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.component.d.ts +71 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.component.d.ts.map +1 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.component.html +41 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.data.d.ts +4 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.data.d.ts.map +1 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.interface.d.ts +6 -0
- package/src/picker/components/rollerTimePicker/rollerTimePicker.interface.d.ts.map +1 -0
- package/src/picker/components/yearPicker/yearPicker.component.d.ts.map +1 -1
- package/src/picker/components/yearPicker/yearPicker.component.html +6 -6
- package/src/picker/directives/index.d.ts +4 -0
- package/src/picker/directives/index.d.ts.map +1 -0
- package/src/picker/directives/loopScroll/loopScroll.directive.d.ts +73 -0
- package/src/picker/directives/loopScroll/loopScroll.directive.d.ts.map +1 -0
- package/src/picker/directives/loopScroll/loopScroll.interface.d.ts +14 -0
- package/src/picker/directives/loopScroll/loopScroll.interface.d.ts.map +1 -0
- package/src/picker/directives/loopScrollData/loopScrollData.directive.d.ts +16 -0
- package/src/picker/directives/loopScrollData/loopScrollData.directive.d.ts.map +1 -0
- package/src/picker/misc/datetimePicker.interface.d.ts +14 -10
- package/src/picker/misc/datetimePicker.interface.d.ts.map +1 -1
- package/src/picker/modules/picker.module.d.ts +10 -7
- package/src/picker/modules/picker.module.d.ts.map +1 -1
- package/src/selector/components/inputDateTime/inputDateTime.component.d.ts +2 -2
- package/src/selector/components/inputDateTime/inputDateTime.component.d.ts.map +1 -1
- package/src/selector/components/inputDateTime/inputDateTime.component.html +1 -1
- package/src/selector/components/selector/selector.component.d.ts +7 -6
- package/src/selector/components/selector/selector.component.d.ts.map +1 -1
- package/src/selector/components/selector/selector.component.html +6 -5
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts +1 -1
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.d.ts.map +1 -1
- package/src/selector/components/simpleInputDateTime/simpleInputDateTime.component.html +1 -1
- package/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.d.ts +80 -0
- package/src/selector/directives/dateTimePickerRenderer/dateTimePickerRenderer.directive.d.ts.map +1 -0
- package/src/selector/directives/selectorControlValueAccessor/selectorControlValueAccessor.directive.d.ts.map +1 -1
- package/src/selector/misc/datetimeSelector.interface.d.ts +16 -3
- package/src/selector/misc/datetimeSelector.interface.d.ts.map +1 -1
- package/src/selector/misc/tokens.d.ts +1 -1
- package/src/selector/misc/tokens.d.ts.map +1 -1
- package/src/selector/modules/selector.module.d.ts +5 -4
- package/src/selector/modules/selector.module.d.ts.map +1 -1
- package/src/services/dateApi.interface.d.ts +72 -0
- package/src/services/dateApi.interface.d.ts.map +1 -1
- package/src/services/datePositionParser.service.d.ts +3 -3
- package/src/services/datePositionParser.service.d.ts.map +1 -1
- package/src/services/dateTimeRelativeParser.service.d.ts +8 -0
- package/src/services/dateTimeRelativeParser.service.d.ts.map +1 -1
- package/src/services/dateValueProvider.service.d.ts.map +1 -1
- package/src/services/formatProvider.interface.d.ts +48 -4
- package/src/services/formatProvider.interface.d.ts.map +1 -1
- package/version.bak +1 -1
- package/es2015/karma.conf.js +0 -57
- package/es2015/karma.conf.js.map +0 -1
- package/es2015/src/pipes/asRequiredType.js +0 -22
- package/es2015/src/pipes/asRequiredType.js.map +0 -1
- package/es2020/karma.conf.js +0 -57
- package/es2020/karma.conf.js.map +0 -1
- package/es2020/src/pipes/asRequiredType.js +0 -22
- package/es2020/src/pipes/asRequiredType.js.map +0 -1
- package/karma.conf.d.ts +0 -2
- package/karma.conf.d.ts.map +0 -1
- package/src/pipes/asRequiredType.d.ts +0 -21
- package/src/pipes/asRequiredType.d.ts.map +0 -1
- package/tsconfig.karma.json +0 -19
package/changelog.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Version 3.0.0 (2022-03-21)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- fixed date-fns bug with displaying *dateTime* format
|
|
8
|
+
- fixed placeholder value of `undefined`
|
|
9
|
+
- fixed problem with occasionally error *cant access property length*
|
|
10
|
+
- fixed not working setting *disabled* or *enabled* from code
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- `DateApiObject` interface
|
|
15
|
+
- new `startOfHour` method, that updates value to start date and time of current hour
|
|
16
|
+
- new `endOfHour` method, that updates value to end date and time of current hour
|
|
17
|
+
- new `addHours` method, that add hours, if count not specified adds 1 hour
|
|
18
|
+
- new `subtractHours` method, that subtract hours, if count not specified subtract 1 hour
|
|
19
|
+
- new `startOfMinute` method, that updates value to start date and time of current minute
|
|
20
|
+
- new `endOfMinute` method, that updates value to end date and time of current minute
|
|
21
|
+
- new `addMinutes` method, that add minutes, if count not specified adds 1 minute
|
|
22
|
+
- new `subtractMinutes` method, that subtract minutes, if count not specified subtract 1 minute
|
|
23
|
+
- new `hour` method, that gets or sets hours zero based
|
|
24
|
+
- new `minute` method, that gets or sets minutes zero based
|
|
25
|
+
- `DateTimeRelativeParser` now supports *hours* and *minutes* as relative values
|
|
26
|
+
- `FormatProvider` interface
|
|
27
|
+
- new `year` property, that is format token for displaying full year
|
|
28
|
+
- new `month` property, that is format token for displaying month double digit number
|
|
29
|
+
- new `week` property, that is format token for displaying week double digit number
|
|
30
|
+
- new `day` property, that is format token for displaying day double digit number
|
|
31
|
+
- new `hour` property, that is format token for displaying hour (24h format) double digit number
|
|
32
|
+
- new `minute` property, that is format token for displaying minute double digit number
|
|
33
|
+
- new `second` property, that is format token for displaying second double digit number
|
|
34
|
+
- new `dayName` property, that is format token for displaying standalone day full name
|
|
35
|
+
- new `dayNameShort` property, that is format token for displaying standalone day short name
|
|
36
|
+
- new `monthName` property, that is format token for displaying standalone month full name
|
|
37
|
+
- new `monthNameShort` property, that is format token for displaying standalone month short name
|
|
38
|
+
- `DateTimeSelectorOptions` interface
|
|
39
|
+
- now allows absolute positioning of picker, which is default
|
|
40
|
+
- new `pickerAbsolute` property, that is indication whether use absolute positioning of picker
|
|
41
|
+
- new `positionOptions` property, that is position options that are used in case of absolute picker
|
|
42
|
+
- new `pickerAbsoluteContainer` property, that is css selector for absolute picker container
|
|
43
|
+
- new `PickerImplBaseComponent` abstract component, that is base class used as base for picker as base implementation of DateTimePicker interface
|
|
44
|
+
- updated `PickerBaseComponent` now extends `PickerImplBaseComponent`
|
|
45
|
+
- new `DateTimePickerRendererDirective` directive, that is used for rendering datetime picker in selector
|
|
46
|
+
- *inputs*
|
|
47
|
+
- `options` current options used by selector
|
|
48
|
+
- `dateTimePicker` current selected value
|
|
49
|
+
- `minValue` gets or sets minimal possible value for picker, that can be picked
|
|
50
|
+
- `maxValue` gets or sets maximal possible value for picker, that can be picked
|
|
51
|
+
- `selectorElement` selector element which is used during absolute positioning of picker
|
|
52
|
+
- *outputs*
|
|
53
|
+
- `valueChange` occurs when value changes
|
|
54
|
+
- `DateTimeDayPickerComponent` component now supports scaling down to *dateTime*
|
|
55
|
+
- `CommonPickerCssClasses` interface
|
|
56
|
+
- new `clickable` property, that is name of css class that represents clickable items in picker
|
|
57
|
+
- new `DateTimeRollerTimePickerComponent` component used for rendering roller time picker
|
|
58
|
+
- new `RollerTimePickerCssClasses` interface, that holds specific css classes for roller time picker
|
|
59
|
+
- new `LoopScrollDirective` directive that renders loop scroll for array of elements
|
|
60
|
+
- *selector* `"loopScroll"`
|
|
61
|
+
- *inputs*
|
|
62
|
+
- `loopScroll` value that is being set in loop scroll
|
|
63
|
+
- `open` indication whether is currently selection scroll open
|
|
64
|
+
- *outputs*
|
|
65
|
+
- `loopScrollChange` occurs when current value of loop scroll changes
|
|
66
|
+
- *ContentChildren* of `LoopScrollDataDirective`, that is array of items that are loop scrolled
|
|
67
|
+
- new `LoopScrollData` interface, that represents data for LoopScrollDirective
|
|
68
|
+
- new `LoopScrollDataDirective` directive, that is loop scroll data that are used inside LoopScrollDirective
|
|
69
|
+
- *selector* `"loopScrollData"`
|
|
70
|
+
- *inputs*
|
|
71
|
+
- `loopScrollData` data for loop
|
|
72
|
+
- updated `InputDateTimeSelectorComponent` now supports *hours* and *minutes*
|
|
73
|
+
- updated `DateValueProvider` now supports *hours* and *minutes*
|
|
74
|
+
- *subpackage* `@anglr/datetime/moment`
|
|
75
|
+
- updated `MomentDateApiObject` to correspond with `DateApiObject` interface
|
|
76
|
+
- updated `MOMENT_FORMAT_PROVIDER` to correspond with `FormatProvider` interface
|
|
77
|
+
- *subpackage* `@anglr/datetime/date-fns`
|
|
78
|
+
- updated `DateFnsDateApiObject` to correspond with `DateApiObject` interface
|
|
79
|
+
- updated `DATEFNS_FORMAT_PROVIDER` to correspond with `FormatProvider` interface
|
|
80
|
+
|
|
81
|
+
### BREAKING CHANGES
|
|
82
|
+
|
|
83
|
+
- minimal supported version of `@anglr/common` is `11.2.0`
|
|
84
|
+
- removed `AsRequiredTypePipe` replaced with one from `@anglr/common`
|
|
85
|
+
- strict null checks
|
|
86
|
+
- both `DateTimePickerOptions` and `DateTimeSelectorOptions` have now all properties required, and options are now passed as `Partial`
|
|
87
|
+
- updated `CommonPickerCssClasses` have now all properties required, and setting is now passed as `Partial`
|
|
88
|
+
|
|
3
89
|
## Version 2.0.1 (2022-02-22)
|
|
4
90
|
|
|
5
91
|
### Bug Fixes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,aAAa,CAAwD,CAAC;AAEnH;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAC,aAAa,EAAC,MAAM,mCAAmC,CAAC;AAEhE;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,aAAa,CAAwD,CAAC;AAEnH;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,eAsBrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFnsDateApi.service.d.ts","sourceRoot":"","sources":["dateFnsDateApi.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAK1F,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;;
|
|
1
|
+
{"version":3,"file":"dateFnsDateApi.service.d.ts","sourceRoot":"","sources":["dateFnsDateApi.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAK1F,OAAO,EAAC,aAAa,EAAC,MAAM,yBAAyB,CAAC;;AA+pBtD;;GAEG;AACH,qBACa,cAAe,YAAW,OAAO,CAAC,IAAI,CAAC;IAGX,SAAS,CAAC,UAAU,EAAE,aAAa;IAC5D,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;gBADpB,UAAU,EAAE,aAAa,EAClD,eAAe,EAAE,sBAAsB,CAAC,IAAI,CAAC;IAMnE;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC;IAK5E;;OAEG;IACI,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC;IAKjC;;;OAGG;IACI,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAuC9C;;OAEG;IACI,kBAAkB,IAAI,OAAO;IAKpC;;OAEG;IACI,aAAa,IAAI,MAAM,EAAE;yCAlFvB,cAAc;6CAAd,cAAc;CA8F1B"}
|
|
@@ -13,7 +13,18 @@ export const DATEFNS_FORMAT_PROVIDER = {
|
|
|
13
13
|
return {
|
|
14
14
|
date: 'P',
|
|
15
15
|
dateTime: 'Pp',
|
|
16
|
-
time: 'p'
|
|
16
|
+
time: 'p',
|
|
17
|
+
year: 'yyyy',
|
|
18
|
+
month: 'MM',
|
|
19
|
+
week: 'ww',
|
|
20
|
+
day: 'dd',
|
|
21
|
+
hour: 'HH',
|
|
22
|
+
minute: 'mm',
|
|
23
|
+
second: 'ss',
|
|
24
|
+
dayName: 'cccc',
|
|
25
|
+
dayNameShort: 'cccccc',
|
|
26
|
+
monthName: 'LLLL',
|
|
27
|
+
monthNameShort: 'LLL'
|
|
17
28
|
};
|
|
18
29
|
}
|
|
19
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAiB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAIhE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC,IAAI,cAAc,CAAgB,iBAAiB,CAAC,CAAC;AAEnH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GACpC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,GAAG;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../date-fns/src/misc/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAiB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAIhE;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAkC,IAAI,cAAc,CAAgB,iBAAiB,CAAC,CAAC;AAEnH;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GACpC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,QAAQ;YACtB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC","sourcesContent":["import {FactoryProvider, InjectionToken} from '@angular/core';\nimport {FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\nimport {DateFnsLocale} from '../services/dateFnsLocale.service';\n\n/**\n * Injection token used for obtaining Date fns locale service\n */\nexport const DATE_FNS_LOCALE: InjectionToken<DateFnsLocale> = new InjectionToken<DateFnsLocale>('DATE_FNS_LOCALE');\n\n/**\n * Injection token used for obtaining date-fns FormatProvider implementation\n */\nexport const DATEFNS_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'P',\n dateTime: 'Pp',\n time: 'p',\n year: 'yyyy',\n month: 'MM',\n week: 'ww',\n day: 'dd',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'cccc',\n dayNameShort: 'cccccc',\n monthName: 'LLLL',\n monthNameShort: 'LLL'\n };\n }\n};"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Inject, Injectable } from '@angular/core';
|
|
2
2
|
import { DateTimeRelativeParser } from '@anglr/datetime';
|
|
3
3
|
import { isBlank, isPresent, isString } from '@jscrpt/common';
|
|
4
|
-
import { toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay } from 'date-fns';
|
|
4
|
+
import { toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay, subHours, addHours, endOfHour, startOfHour, startOfMinute, endOfMinute, addMinutes, subMinutes, getHours, setHours, getMinutes, setMinutes } from 'date-fns';
|
|
5
5
|
import { DATE_FNS_LOCALE } from '../misc/tokens';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
import * as i1 from "@anglr/datetime";
|
|
@@ -78,9 +78,9 @@ class DateFnsDateApiObject {
|
|
|
78
78
|
return this;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
* Updates value to start date and time of current year
|
|
82
|
+
* @returns Itself for fluent API
|
|
83
|
+
*/
|
|
84
84
|
startOfYear() {
|
|
85
85
|
this._value = startOfYear(this._value);
|
|
86
86
|
return this;
|
|
@@ -213,6 +213,74 @@ class DateFnsDateApiObject {
|
|
|
213
213
|
this._value = subDays(this._value, count !== null && count !== void 0 ? count : 1);
|
|
214
214
|
return this;
|
|
215
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Updates value to start date and time of current hour
|
|
218
|
+
* @returns Itself for fluent API
|
|
219
|
+
*/
|
|
220
|
+
startOfHour() {
|
|
221
|
+
this._value = startOfHour(this._value);
|
|
222
|
+
return this;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Updates value to end date and time of current hour
|
|
226
|
+
* @returns Itself for fluent API
|
|
227
|
+
*/
|
|
228
|
+
endOfHour() {
|
|
229
|
+
this._value = endOfHour(this._value);
|
|
230
|
+
return this;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Add hours, if count not specified adds 1 hour
|
|
234
|
+
* @param count - Number of hours count
|
|
235
|
+
* @returns Itself for fluent API
|
|
236
|
+
*/
|
|
237
|
+
addHours(count) {
|
|
238
|
+
this._value = addHours(this._value, count !== null && count !== void 0 ? count : 1);
|
|
239
|
+
return this;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Subtract hours, if count not specified subtract 1 hour
|
|
243
|
+
* @param count - Number of hours count
|
|
244
|
+
* @returns Itself for fluent API
|
|
245
|
+
*/
|
|
246
|
+
subtractHours(count) {
|
|
247
|
+
this._value = subHours(this._value, count !== null && count !== void 0 ? count : 1);
|
|
248
|
+
return this;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Updates value to start date and time of current minute
|
|
252
|
+
* @returns Itself for fluent API
|
|
253
|
+
*/
|
|
254
|
+
startOfMinute() {
|
|
255
|
+
this._value = startOfMinute(this._value);
|
|
256
|
+
return this;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Updates value to end date and time of current minute
|
|
260
|
+
* @returns Itself for fluent API
|
|
261
|
+
*/
|
|
262
|
+
endOfMinute() {
|
|
263
|
+
this._value = endOfMinute(this._value);
|
|
264
|
+
return this;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Add minutes, if count not specified adds 1 minute
|
|
268
|
+
* @param count - Number of minutes count
|
|
269
|
+
* @returns Itself for fluent API
|
|
270
|
+
*/
|
|
271
|
+
addMinutes(count) {
|
|
272
|
+
this._value = addMinutes(this._value, count !== null && count !== void 0 ? count : 1);
|
|
273
|
+
return this;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Subtract minutes, if count not specified subtract 1 minute
|
|
277
|
+
* @param count - Number of minutes count
|
|
278
|
+
* @returns Itself for fluent API
|
|
279
|
+
*/
|
|
280
|
+
subtractMinutes(count) {
|
|
281
|
+
this._value = subMinutes(this._value, count !== null && count !== void 0 ? count : 1);
|
|
282
|
+
return this;
|
|
283
|
+
}
|
|
216
284
|
/**
|
|
217
285
|
* Gets number of days in month
|
|
218
286
|
*/
|
|
@@ -263,6 +331,28 @@ class DateFnsDateApiObject {
|
|
|
263
331
|
}
|
|
264
332
|
return getISODay(this._value) - 1;
|
|
265
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Gets or sets hours zero based
|
|
336
|
+
* @param hour - If specified, sets hour
|
|
337
|
+
*/
|
|
338
|
+
hour(hour) {
|
|
339
|
+
if (isPresent(hour)) {
|
|
340
|
+
this._value = setHours(this._value, hour);
|
|
341
|
+
return this;
|
|
342
|
+
}
|
|
343
|
+
return getHours(this._value);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Gets or sets minutes zero based
|
|
347
|
+
* @param minute - If specified, sets minutes
|
|
348
|
+
*/
|
|
349
|
+
minute(minute) {
|
|
350
|
+
if (isPresent(minute)) {
|
|
351
|
+
this._value = setMinutes(this._value, minute);
|
|
352
|
+
return this;
|
|
353
|
+
}
|
|
354
|
+
return getMinutes(this._value);
|
|
355
|
+
}
|
|
266
356
|
/**
|
|
267
357
|
* Gets indication whether current value is before 'date'
|
|
268
358
|
* @param date - Date which is this date compared to
|
|
@@ -387,6 +477,9 @@ export class DateFnsDateApi {
|
|
|
387
477
|
*/
|
|
388
478
|
getFormat(pseudoFormat) {
|
|
389
479
|
if (/^p+$/i.test(pseudoFormat)) {
|
|
480
|
+
if (!this._localeSvc.locale.formatLong) {
|
|
481
|
+
throw new Error('Missing long formats for locale in DateApi');
|
|
482
|
+
}
|
|
390
483
|
const widths = {
|
|
391
484
|
1: 'short',
|
|
392
485
|
2: 'medium',
|
|
@@ -395,7 +488,8 @@ export class DateFnsDateApi {
|
|
|
395
488
|
};
|
|
396
489
|
//date time format
|
|
397
490
|
if (pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8) {
|
|
398
|
-
|
|
491
|
+
const partLength = pseudoFormat.length / 2;
|
|
492
|
+
return `${this._localeSvc.locale.formatLong.date({ width: widths[partLength] })} ${this._localeSvc.locale.formatLong.time({ width: widths[partLength] })}`;
|
|
399
493
|
}
|
|
400
494
|
//date format
|
|
401
495
|
else if (pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dateFnsDateApi.service.js","sourceRoot":"","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AAa;QAEhB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAQ,CAAC,YAAa,CAAC;QAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EACzB;YACI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;SAC3F;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;;2GAtFQ,cAAc,kBAGH,eAAe;+GAH1B,cAAc;2FAAd,cAAc;kBAD1B,UAAU;;0BAIM,MAAM;2BAAC,eAAe","sourcesContent":["import {Inject, Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### private fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n private _originalValue: Date;\n\n /**\n * Instance of date\n */\n private _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n protected _localeSvc: DateFnsLocale,\n format?: string)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year!);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month!);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day!);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1!);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: Date): boolean\n {\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: Date): boolean\n {\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: Date): number\n {\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: Date): boolean\n {\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: Date): boolean\n {\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: Date): boolean\n {\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: Date): boolean\n {\n return isSameMonth(this._value, date);\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: Date): boolean\n {\n return isSameDay(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(this._relativeParser.parse(value), this._localeSvc, format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(), this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n return this._localeSvc.locale.formatLong!.dateTime({width: widths[pseudoFormat.length / 2]});\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong!.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong!.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"dateFnsDateApi.service.js","sourceRoot":"","sources":["../../../../date-fns/src/services/dateFnsDateApi.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAoC,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAC1F,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EA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AG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC,EAClE;gBACI,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,EAAC,CAAC,CAAC;aACvF;SACJ;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;IAED;;OAEG;IACI,kBAAkB;;QAErB,OAAO,CAAA,MAAA,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,0CAAE,YAAY,MAAK,CAAC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACI,aAAa;QAEhB,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAQ,CAAC,YAAa,CAAC;QAC/D,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,KAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EACzB;YACI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,QAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,CAAC,CAAC,CAAC;SAC3F;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;;2GA7FQ,cAAc,kBAGH,eAAe;+GAH1B,cAAc;2FAAd,cAAc;kBAD1B,UAAU;;0BAIM,MAAM;2BAAC,eAAe","sourcesContent":["import {Inject, Injectable} from '@angular/core';\nimport {DateApi, DateValue, DateApiObject, DateTimeRelativeParser} from '@anglr/datetime';\nimport {isBlank, isPresent, isString} from '@jscrpt/common';\nimport {toDate, getDate, setDate, isAfter, isBefore, differenceInCalendarDays, format, startOfMonth, endOfMonth, startOfWeek, endOfWeek, startOfDay, endOfDay, addMonths, addWeeks, addDays, subMonths, subWeeks, subDays, getDaysInMonth, isSameDay, isSameWeek, isSameMonth, isValid, parse, parseISO, addYears, subYears, startOfYear, endOfYear, isWeekend, setYear, getYear, isSameYear, startOfDecade, endOfDecade, setMonth, getMonth, setISODay, getISODay, subHours, addHours, endOfHour, startOfHour, startOfMinute, endOfMinute, addMinutes, subMinutes, getHours, setHours, getMinutes, setMinutes} from 'date-fns';\n\nimport {DATE_FNS_LOCALE} from '../misc/tokens';\nimport {DateFnsLocale} from './dateFnsLocale.service';\n\n/**\n * Instance of object wrapping TDate, allowing manipulation with it\n */\nclass DateFnsDateApiObject implements DateApiObject<Date>\n{\n //######################### private fields #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n private _originalValue: Date;\n\n /**\n * Instance of date\n */\n private _value: Date;\n\n //######################### public properties - implementation of DateApiObject #########################\n\n /**\n * Original value that is not changed unless 'updateOriginal' is called\n */\n public get originalValue(): Date\n {\n return this._originalValue;\n }\n\n /**\n * Instance of date\n */\n public get value(): Date\n {\n return this._value;\n }\n\n //######################### constructor #########################\n constructor(value: DateValue|Date,\n protected _localeSvc: DateFnsLocale,\n format?: string)\n {\n if(isString(value))\n {\n //ISO string\n if(/^\\d+-\\d+-\\d+(T\\d+:\\d+:\\d+)?/.test(value))\n {\n this._value = this._originalValue = parseISO(value);\n }\n else\n {\n if(isBlank(format))\n {\n throw new Error('date-fns requires format parameter to be set for parsing non ISO string date!');\n }\n\n this._value = this._originalValue = parse(value, format, new Date(1970, 0));\n }\n }\n else\n {\n this._value = this._originalValue = toDate(value);\n }\n }\n\n //######################### public methods - implementation of DateApiObject #########################\n\n /**\n * Gets indication whether provided instance of date is valid\n */\n public isValid(): boolean\n {\n return isValid(this._value);\n }\n\n /**\n * Gets indication whether provided instance of date is weekend day\n */\n public isWeekend(): boolean\n {\n return isWeekend(this._value);\n }\n\n /**\n * Formats date value\n * @param formatString - Format token used for creating formatted string\n */\n public format(formatString: string): string\n {\n return format(this._value, formatString, {locale: this._localeSvc.locale});\n }\n\n /**\n * Updates value to start date and time of current decade\n * @returns Itself for fluent API\n */\n public startOfDecade(): DateApiObject<Date>\n {\n this._value = startOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to end date and time of current decade\n * @returns Itself for fluent API\n */\n public endOfDecade(): DateApiObject<Date>\n {\n this._value = endOfDecade(this._value);\n \n return this;\n }\n\n /**\n * Updates value to start date and time of current year\n * @returns Itself for fluent API\n */\n public startOfYear(): DateApiObject<Date>\n {\n this._value = startOfYear(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current year\n * @returns Itself for fluent API\n */\n public endOfYear(): DateApiObject<Date>\n {\n this._value = endOfYear(this._value);\n\n return this;\n }\n\n /**\n * Add years, if count not specified adds 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public addYears(count?: number): DateApiObject<Date>\n {\n this._value = addYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract years, if count not specified subtract 1 year\n * @param count - Number of years count\n * @returns Itself for fluent API\n */\n public subtractYears(count?: number): DateApiObject<Date>\n {\n this._value = subYears(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current month\n * @returns Itself for fluent API\n */\n public startOfMonth(): DateApiObject<Date>\n {\n this._value = startOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current month\n * @returns Itself for fluent API\n */\n public endOfMonth(): DateApiObject<Date>\n {\n this._value = endOfMonth(this._value);\n\n return this;\n }\n\n /**\n * Add months, if count not specified adds 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public addMonths(count?: number): DateApiObject<Date>\n {\n this._value = addMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract months, if count not specified subtract 1 month\n * @param count - Number of months count\n * @returns Itself for fluent API\n */\n public subtractMonths(count?: number): DateApiObject<Date>\n {\n this._value = subMonths(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current week\n * @returns Itself for fluent API\n */\n public startOfWeek(): DateApiObject<Date>\n {\n this._value = startOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current week\n * @returns Itself for fluent API\n */\n public endOfWeek(): DateApiObject<Date>\n {\n this._value = endOfWeek(this._value, {locale: this._localeSvc.locale});\n\n return this;\n }\n\n /**\n * Add weeks, if count not specified adds 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public addWeeks(count?: number): DateApiObject<Date>\n {\n this._value = addWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract weeks, if count not specified subtract 1 week\n * @param count - Number of weeks count\n * @returns Itself for fluent API\n */\n public subtractWeeks(count?: number): DateApiObject<Date>\n {\n this._value = subWeeks(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current day\n * @returns Itself for fluent API\n */\n public startOfDay(): DateApiObject<Date>\n {\n this._value = startOfDay(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current day\n * @returns Itself for fluent API\n */\n public endOfDay(): DateApiObject<Date>\n {\n this._value = endOfDay(this._value);\n\n return this;\n }\n\n /**\n * Add days, if count not specified adds 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public addDays(count?: number): DateApiObject<Date>\n {\n this._value = addDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract days, if count not specified subtract 1 day\n * @param count - Number of days count\n * @returns Itself for fluent API\n */\n public subtractDays(count?: number): DateApiObject<Date>\n {\n this._value = subDays(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current hour\n * @returns Itself for fluent API\n */\n public startOfHour(): DateApiObject<Date>\n {\n this._value = startOfHour(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current hour\n * @returns Itself for fluent API\n */\n public endOfHour(): DateApiObject<Date>\n {\n this._value = endOfHour(this._value);\n\n return this;\n }\n\n /**\n * Add hours, if count not specified adds 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public addHours(count?: number): DateApiObject<Date>\n {\n this._value = addHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract hours, if count not specified subtract 1 hour\n * @param count - Number of hours count\n * @returns Itself for fluent API\n */\n public subtractHours(count?: number): DateApiObject<Date>\n {\n this._value = subHours(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Updates value to start date and time of current minute\n * @returns Itself for fluent API\n */\n public startOfMinute(): DateApiObject<Date>\n {\n this._value = startOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Updates value to end date and time of current minute\n * @returns Itself for fluent API\n */\n public endOfMinute(): DateApiObject<Date>\n {\n this._value = endOfMinute(this._value);\n\n return this;\n }\n\n /**\n * Add minutes, if count not specified adds 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public addMinutes(count?: number): DateApiObject<Date>\n {\n this._value = addMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Subtract minutes, if count not specified subtract 1 minute\n * @param count - Number of minutes count\n * @returns Itself for fluent API\n */\n public subtractMinutes(count?: number): DateApiObject<Date>\n {\n this._value = subMinutes(this._value, count ?? 1);\n\n return this;\n }\n\n /**\n * Gets number of days in month\n */\n public daysInMonth(): number\n {\n return getDaysInMonth(this._value);\n }\n\n /**\n * Gets year\n */\n public year(): number;\n /**\n * Sets year\n * @param year - Year to be set\n */\n public year(year: number): DateApiObject<Date>;\n /**\n * Gets or sets year\n * @param year - If specified, sets year\n */\n public year(year?: number): DateApiObject<Date>|number\n {\n if(isPresent(year))\n {\n this._value = setYear(this._value, year);\n\n return this;\n }\n\n return getYear(this._value);\n }\n\n /**\n * Gets month\n */\n public month(): number\n /**\n * Sets month\n * @param month - Month to be set\n */\n public month(month: number): DateApiObject<Date>\n /**\n * Gets or sets month\n * @param month - If specified, sets month\n */\n public month(month?: number): DateApiObject<Date>|number\n {\n if(isPresent(month))\n {\n this._value = setMonth(this._value, month);\n\n return this;\n }\n\n return getMonth(this._value);\n }\n\n /**\n * Gets day of month one based\n */\n public dayOfMonth(): number;\n /**\n * Sets day of month one based\n * @param day - Day of month to be set\n */\n public dayOfMonth(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of month one based\n * @param day - If specified, sets day of month\n */\n public dayOfMonth(day?: number): DateApiObject<Date>|number\n {\n if(isPresent(day))\n {\n this._value = setDate(this._value, day);\n\n return this;\n }\n\n return getDate(this._value);\n }\n\n /**\n * Gets day of week zero based, first is monday\n */\n public dayOfWeek(): number;\n /**\n * Sets day of week zero based, first is monday\n * @param day - Day of week to be set\n */\n public dayOfWeek(day: number): DateApiObject<Date>;\n /**\n * Gets or sets day of week zero based, first is monday\n * @param day - If specified, sets day of week\n */\n public dayOfWeek(day?: number): number|DateApiObject<Date>\n {\n if(isPresent(day))\n {\n this._value = setISODay(this._value, day + 1!);\n\n return this;\n }\n\n return getISODay(this._value) - 1;\n }\n\n /**\n * Gets hours zero based\n */\n public hour(): number;\n /**\n * Sets hours zero based\n * @param hour - hour to be set\n */\n public hour(hour: number): DateApiObject<Date>;\n /**\n * Gets or sets hours zero based\n * @param hour - If specified, sets hour\n */\n public hour(hour?: number): DateApiObject<Date>|number\n {\n if(isPresent(hour))\n {\n this._value = setHours(this._value, hour);\n\n return this;\n }\n\n return getHours(this._value);\n }\n\n /**\n * Gets minutes zero based\n */\n public minute(): number;\n /**\n * Sets minutes zero based\n * @param minute - minutes to be set\n */\n public minute(minute: number): DateApiObject<Date>;\n /**\n * Gets or sets minutes zero based\n * @param minute - If specified, sets minutes\n */\n public minute(minute?: number): DateApiObject<Date>|number\n {\n if(isPresent(minute))\n {\n this._value = setMinutes(this._value, minute);\n\n return this;\n }\n\n return getMinutes(this._value);\n }\n\n /**\n * Gets indication whether current value is before 'date'\n * @param date - Date which is this date compared to\n */\n public isBefore(date: Date): boolean\n {\n return isBefore(this._value, date);\n }\n\n /**\n * Gets indication whether current value is after 'date'\n * @param date - Date which is this date compared to\n */\n public isAfter(date: Date): boolean\n {\n return isAfter(this._value, date);\n }\n\n /**\n * Gets number of days between this and provided date\n * @param date - Date which is used for computation of diff against\n */\n public diffDays(date: Date): number\n {\n return differenceInCalendarDays(this._value, date);\n }\n\n /**\n * Compares whether this date is same week as provided date\n * @param date - Date which is used for comparison of same week\n */\n public isSameWeek(date: Date): boolean\n {\n return isSameWeek(this._value, date, {locale: this._localeSvc.locale});\n }\n\n /**\n * Compares whether this date is same decade as provided date\n * @param date - Date which is used for comparison of same decade\n */\n public isSameDecade(date: Date): boolean\n {\n const year = getYear(this._value);\n const start = year - (year % 10);\n const end = start + 10;\n\n return getYear(date) >= start && getYear(date) < end;\n }\n\n /**\n * Compares whether this date is same year as provided date\n * @param date - Date which is used for comparison of same year\n */\n public isSameYear(date: Date): boolean\n {\n return isSameYear(this._value, date);\n }\n\n /**\n * Compares whether this date is same month as provided date\n * @param date - Date which is used for comparison of same month\n */\n public isSameMonth(date: Date): boolean\n {\n return isSameMonth(this._value, date);\n }\n\n /**\n * Compares whether this date is same day as provided date\n * @param date - Date which is used for comparison of same day\n */\n public isSameDay(date: Date): boolean\n {\n return isSameDay(this._value, date);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from value\n */\n public clone(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._value), this._localeSvc);\n }\n\n /**\n * Creates clone of this instance, value and originalValue have same value and are cloned from originalValue\n */\n public cloneOriginal(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(this._originalValue), this._localeSvc);\n }\n\n /**\n * Updates originalValue, if value is not provided originalValue is set to value\n * @param value - Value to be set as original, or null (value will be used as value)\n * @returns Itself for fluent API\n */\n public updateOriginal(value?: Date): DateApiObject<Date>\n {\n if(isBlank(value))\n {\n this._originalValue = this._value;\n }\n else\n {\n this._value = this._originalValue = value!;\n }\n\n return this;\n }\n\n /**\n * Changes value to same value as originalValue\n * @returns Itself for fluent API\n */\n public resetOriginal(): DateApiObject<Date>\n {\n this._value = this._originalValue;\n\n return this;\n }\n}\n\n/**\n * Date api using DateFnsJS, used for obtaining DateApi wrapper object\n */\n@Injectable()\nexport class DateFnsDateApi implements DateApi<Date>\n{\n //######################### constructor #########################\n constructor(@Inject(DATE_FNS_LOCALE) protected _localeSvc: DateFnsLocale,\n protected _relativeParser: DateTimeRelativeParser<Date>)\n {\n }\n\n //######################### public methods - implementation of DateApi #########################\n\n /**\n * Gets wrapping object used for manipulation\n * @param value - Value to be converted (parsed) and used for manipulation\n * @param format - Format string used for parsing string value\n */\n public getValue(value: DateValue|Date, format?: string): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(this._relativeParser.parse(value), this._localeSvc, format);\n }\n\n /**\n * Gets wrapping object used for manipulation instantiated to current date and time\n */\n public now(): DateApiObject<Date>\n {\n return new DateFnsDateApiObject(new Date(), this._localeSvc);\n }\n\n /**\n * Gets format string using pseudo format\n * @param pseudoFormat - Pseudo format token, used for obtaining 'date' or 'time' format string\n */\n public getFormat(pseudoFormat: string): string\n {\n if(/^p+$/i.test(pseudoFormat))\n {\n if(!this._localeSvc.locale.formatLong)\n {\n throw new Error('Missing long formats for locale in DateApi');\n }\n\n const widths: {[index: number]: string} =\n {\n 1: 'short',\n 2: 'medium',\n 3: 'long',\n 4: 'full'\n };\n\n //date time format\n if(pseudoFormat.indexOf('Pp') >= 0 && pseudoFormat.length <= 8)\n {\n const partLength = pseudoFormat.length / 2;\n\n return `${this._localeSvc.locale.formatLong.date({width: widths[partLength]})} ${this._localeSvc.locale.formatLong.time({width: widths[partLength]})}`;\n }\n //date format\n else if(pseudoFormat.indexOf('P') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.date({width: widths[pseudoFormat.length]});\n }\n //time format\n else if(pseudoFormat.indexOf('p') >= 0 && pseudoFormat.length <= 4)\n {\n return this._localeSvc.locale.formatLong.time({width: widths[pseudoFormat.length]});\n }\n }\n\n return pseudoFormat;\n }\n\n /**\n * Gets information \n */\n public weekStartsOnMonday(): boolean\n {\n return this._localeSvc.locale.options?.weekStartsOn === 1;\n }\n\n /**\n * Gets array of weekday names in short format, order of days is dependent on locale\n */\n public weekdaysShort(): string[]\n {\n let startIndex = this._localeSvc.locale.options!.weekStartsOn!;\n const weekdays: string[] = [];\n\n for(let x = 0; x < 7; x++)\n {\n weekdays.push(this._localeSvc.locale.localize!.day(startIndex++ % 7, {width: 'short'}));\n }\n\n return weekdays;\n }\n}"]}
|
|
@@ -8,7 +8,18 @@ export const MOMENT_FORMAT_PROVIDER = {
|
|
|
8
8
|
return {
|
|
9
9
|
date: 'L',
|
|
10
10
|
dateTime: 'L LT',
|
|
11
|
-
time: 'LT'
|
|
11
|
+
time: 'LT',
|
|
12
|
+
year: 'YYYY',
|
|
13
|
+
month: 'MM',
|
|
14
|
+
week: 'ww',
|
|
15
|
+
day: 'DD',
|
|
16
|
+
hour: 'HH',
|
|
17
|
+
minute: 'mm',
|
|
18
|
+
second: 'ss',
|
|
19
|
+
dayName: 'dddd',
|
|
20
|
+
dayNameShort: 'dd',
|
|
21
|
+
monthName: 'MMMM',
|
|
22
|
+
monthNameShort: 'MMM'
|
|
12
23
|
};
|
|
13
24
|
}
|
|
14
25
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../moment/src/misc/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACnC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../../moment/src/misc/tokens.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GACnC;IACI,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,GAAG,EAAE;QAEb,OAAuB;YACnB,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,MAAM;YAChB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,MAAM;YACf,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,MAAM;YACjB,cAAc,EAAE,KAAK;SACxB,CAAC;IACN,CAAC;CACJ,CAAC","sourcesContent":["import {FactoryProvider} from '@angular/core';\nimport {FormatProvider, FORMAT_PROVIDER} from '@anglr/datetime';\n\n/**\n * Injection token used for obtaining moment FormatProvider implementation\n */\nexport const MOMENT_FORMAT_PROVIDER: FactoryProvider =\n{\n provide: FORMAT_PROVIDER,\n useFactory: () =>\n {\n return <FormatProvider>{\n date: 'L',\n dateTime: 'L LT',\n time: 'LT',\n year: 'YYYY',\n month: 'MM',\n week: 'ww',\n day: 'DD',\n hour: 'HH',\n minute: 'mm',\n second: 'ss',\n dayName: 'dddd',\n dayNameShort: 'dd',\n monthName: 'MMMM',\n monthNameShort: 'MMM'\n };\n }\n};"]}
|
|
@@ -200,6 +200,74 @@ class MomentDateApiObject {
|
|
|
200
200
|
this._value = moment(this._value).subtract(count !== null && count !== void 0 ? count : 1, 'days');
|
|
201
201
|
return this;
|
|
202
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Updates value to start date and time of current hour
|
|
205
|
+
* @returns Itself for fluent API
|
|
206
|
+
*/
|
|
207
|
+
startOfHour() {
|
|
208
|
+
this._value = moment(this._value).startOf('hour');
|
|
209
|
+
return this;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Updates value to end date and time of current hour
|
|
213
|
+
* @returns Itself for fluent API
|
|
214
|
+
*/
|
|
215
|
+
endOfHour() {
|
|
216
|
+
this._value = moment(this._value).endOf('hour');
|
|
217
|
+
return this;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Add hours, if count not specified adds 1 hour
|
|
221
|
+
* @param count - Number of hours count
|
|
222
|
+
* @returns Itself for fluent API
|
|
223
|
+
*/
|
|
224
|
+
addHours(count) {
|
|
225
|
+
this._value = moment(this._value).add(count !== null && count !== void 0 ? count : 1, 'hours');
|
|
226
|
+
return this;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Subtract hours, if count not specified subtract 1 hour
|
|
230
|
+
* @param count - Number of hours count
|
|
231
|
+
* @returns Itself for fluent API
|
|
232
|
+
*/
|
|
233
|
+
subtractHours(count) {
|
|
234
|
+
this._value = moment(this._value).subtract(count !== null && count !== void 0 ? count : 1, 'hours');
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Updates value to start date and time of current minute
|
|
239
|
+
* @returns Itself for fluent API
|
|
240
|
+
*/
|
|
241
|
+
startOfMinute() {
|
|
242
|
+
this._value = moment(this._value).startOf('minute');
|
|
243
|
+
return this;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Updates value to end date and time of current minute
|
|
247
|
+
* @returns Itself for fluent API
|
|
248
|
+
*/
|
|
249
|
+
endOfMinute() {
|
|
250
|
+
this._value = moment(this._value).endOf('minute');
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Add minutes, if count not specified adds 1 minute
|
|
255
|
+
* @param count - Number of minutes count
|
|
256
|
+
* @returns Itself for fluent API
|
|
257
|
+
*/
|
|
258
|
+
addMinutes(count) {
|
|
259
|
+
this._value = moment(this._value).add(count !== null && count !== void 0 ? count : 1, 'minutes');
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Subtract minutes, if count not specified subtract 1 minute
|
|
264
|
+
* @param count - Number of minutes count
|
|
265
|
+
* @returns Itself for fluent API
|
|
266
|
+
*/
|
|
267
|
+
subtractMinutes(count) {
|
|
268
|
+
this._value = moment(this._value).subtract(count !== null && count !== void 0 ? count : 1, 'minutes');
|
|
269
|
+
return this;
|
|
270
|
+
}
|
|
203
271
|
/**
|
|
204
272
|
* Gets number of days in month
|
|
205
273
|
*/
|
|
@@ -250,6 +318,28 @@ class MomentDateApiObject {
|
|
|
250
318
|
}
|
|
251
319
|
return this._value.weekday();
|
|
252
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Gets or sets hours zero
|
|
323
|
+
* @param hour - If specified, sets hour
|
|
324
|
+
*/
|
|
325
|
+
hour(hour) {
|
|
326
|
+
if (isPresent(hour)) {
|
|
327
|
+
this._value = moment(this._value).hours(hour);
|
|
328
|
+
return this;
|
|
329
|
+
}
|
|
330
|
+
return this._value.hours();
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Gets or sets minutes zero based
|
|
334
|
+
* @param minute - If specified, sets minutes
|
|
335
|
+
*/
|
|
336
|
+
minute(minute) {
|
|
337
|
+
if (isPresent(minute)) {
|
|
338
|
+
this._value = moment(this._value).minutes(minute);
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
return this._value.minutes();
|
|
342
|
+
}
|
|
253
343
|
/**
|
|
254
344
|
* Gets indication whether current value is before 'date'
|
|
255
345
|
* @param date - Date which is this date compared to
|