oxy-uni-ui 1.0.1
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/LICENSE +21 -0
- package/README.md +13 -0
- package/attributes.json +1 -0
- package/components/common/AbortablePromise.ts +28 -0
- package/components/common/abstracts/_config.scss +7 -0
- package/components/common/abstracts/_function.scss +89 -0
- package/components/common/abstracts/_mixin.scss +385 -0
- package/components/common/abstracts/variable.scss +974 -0
- package/components/common/base64.ts +29 -0
- package/components/common/canvasHelper.ts +49 -0
- package/components/common/clickoutside.ts +25 -0
- package/components/common/event.ts +8 -0
- package/components/common/interceptor.ts +43 -0
- package/components/common/props.ts +51 -0
- package/components/common/util.ts +778 -0
- package/components/composables/index.ts +11 -0
- package/components/composables/useCell.ts +13 -0
- package/components/composables/useChildren.ts +113 -0
- package/components/composables/useCountDown.ts +138 -0
- package/components/composables/useLockScroll.ts +37 -0
- package/components/composables/useParent.ts +41 -0
- package/components/composables/usePopover.ts +176 -0
- package/components/composables/useQueue.ts +52 -0
- package/components/composables/useRaf.ts +37 -0
- package/components/composables/useTouch.ts +43 -0
- package/components/composables/useTranslate.ts +12 -0
- package/components/composables/useUpload.ts +364 -0
- package/components/oxy-action-sheet/index.scss +204 -0
- package/components/oxy-action-sheet/oxy-action-sheet.vue +155 -0
- package/components/oxy-action-sheet/types.ts +118 -0
- package/components/oxy-backtop/index.scss +25 -0
- package/components/oxy-backtop/oxy-backtop.vue +45 -0
- package/components/oxy-backtop/types.ts +37 -0
- package/components/oxy-badge/index.scss +63 -0
- package/components/oxy-badge/oxy-badge.vue +61 -0
- package/components/oxy-badge/types.ts +41 -0
- package/components/oxy-button/index.scss +336 -0
- package/components/oxy-button/oxy-button.vue +195 -0
- package/components/oxy-button/types.ts +133 -0
- package/components/oxy-calendar/index.scss +158 -0
- package/components/oxy-calendar/oxy-calendar.vue +451 -0
- package/components/oxy-calendar/types.ts +217 -0
- package/components/oxy-calendar-view/index.scss +0 -0
- package/components/oxy-calendar-view/month/index.scss +162 -0
- package/components/oxy-calendar-view/month/month.vue +389 -0
- package/components/oxy-calendar-view/month/types.ts +20 -0
- package/components/oxy-calendar-view/monthPanel/index.scss +89 -0
- package/components/oxy-calendar-view/monthPanel/month-panel.vue +374 -0
- package/components/oxy-calendar-view/monthPanel/types.ts +48 -0
- package/components/oxy-calendar-view/oxy-calendar-view.vue +111 -0
- package/components/oxy-calendar-view/types.ts +109 -0
- package/components/oxy-calendar-view/utils.ts +429 -0
- package/components/oxy-calendar-view/year/index.scss +153 -0
- package/components/oxy-calendar-view/year/types.ts +20 -0
- package/components/oxy-calendar-view/year/year.vue +202 -0
- package/components/oxy-calendar-view/yearPanel/index.scss +24 -0
- package/components/oxy-calendar-view/yearPanel/types.ts +38 -0
- package/components/oxy-calendar-view/yearPanel/year-panel.vue +135 -0
- package/components/oxy-card/index.scss +71 -0
- package/components/oxy-card/oxy-card.vue +37 -0
- package/components/oxy-card/types.ts +30 -0
- package/components/oxy-cell/index.scss +206 -0
- package/components/oxy-cell/oxy-cell.vue +140 -0
- package/components/oxy-cell/types.ts +111 -0
- package/components/oxy-cell-group/index.scss +56 -0
- package/components/oxy-cell-group/oxy-cell-group.vue +45 -0
- package/components/oxy-cell-group/types.ts +32 -0
- package/components/oxy-checkbox/index.scss +285 -0
- package/components/oxy-checkbox/oxy-checkbox.vue +177 -0
- package/components/oxy-checkbox/types.ts +68 -0
- package/components/oxy-checkbox-group/index.scss +20 -0
- package/components/oxy-checkbox-group/oxy-checkbox-group.vue +100 -0
- package/components/oxy-checkbox-group/types.ts +59 -0
- package/components/oxy-circle/index.scss +18 -0
- package/components/oxy-circle/oxy-circle.vue +296 -0
- package/components/oxy-circle/types.ts +54 -0
- package/components/oxy-col/index.scss +19 -0
- package/components/oxy-col/oxy-col.vue +49 -0
- package/components/oxy-col/types.ts +15 -0
- package/components/oxy-col-picker/index.scss +168 -0
- package/components/oxy-col-picker/oxy-col-picker.vue +498 -0
- package/components/oxy-col-picker/types.ts +166 -0
- package/components/oxy-collapse/index.scss +55 -0
- package/components/oxy-collapse/oxy-collapse.vue +151 -0
- package/components/oxy-collapse/types.ts +58 -0
- package/components/oxy-collapse-item/index.scss +90 -0
- package/components/oxy-collapse-item/oxy-collapse-item.vue +171 -0
- package/components/oxy-collapse-item/types.ts +48 -0
- package/components/oxy-config-provider/oxy-config-provider.vue +73 -0
- package/components/oxy-config-provider/types.ts +1052 -0
- package/components/oxy-count-down/index.scss +15 -0
- package/components/oxy-count-down/oxy-count-down.vue +60 -0
- package/components/oxy-count-down/types.ts +41 -0
- package/components/oxy-count-down/utils.ts +52 -0
- package/components/oxy-count-to/index.scss +7 -0
- package/components/oxy-count-to/oxy-count-to.vue +125 -0
- package/components/oxy-count-to/types.ts +117 -0
- package/components/oxy-curtain/index.scss +85 -0
- package/components/oxy-curtain/oxy-curtain.vue +172 -0
- package/components/oxy-curtain/types.ts +73 -0
- package/components/oxy-datetime-picker/index.scss +164 -0
- package/components/oxy-datetime-picker/oxy-datetime-picker.vue +801 -0
- package/components/oxy-datetime-picker/types.ts +231 -0
- package/components/oxy-datetime-picker-view/oxy-datetime-picker-view.vue +499 -0
- package/components/oxy-datetime-picker-view/types.ts +120 -0
- package/components/oxy-datetime-picker-view/util.ts +30 -0
- package/components/oxy-design-uni/oxy-design-uni.vue +5 -0
- package/components/oxy-divider/index.scss +100 -0
- package/components/oxy-divider/oxy-divider.vue +52 -0
- package/components/oxy-divider/types.ts +35 -0
- package/components/oxy-drop-menu/index.scss +86 -0
- package/components/oxy-drop-menu/oxy-drop-menu.vue +166 -0
- package/components/oxy-drop-menu/types.ts +38 -0
- package/components/oxy-drop-menu-item/index.scss +66 -0
- package/components/oxy-drop-menu-item/oxy-drop-menu-item.vue +221 -0
- package/components/oxy-drop-menu-item/types.ts +94 -0
- package/components/oxy-fab/index.scss +116 -0
- package/components/oxy-fab/oxy-fab.vue +276 -0
- package/components/oxy-fab/types.ts +66 -0
- package/components/oxy-floating-panel/index.scss +64 -0
- package/components/oxy-floating-panel/oxy-floating-panel.vue +140 -0
- package/components/oxy-floating-panel/type.ts +32 -0
- package/components/oxy-form/oxy-form.vue +207 -0
- package/components/oxy-form/types.ts +76 -0
- package/components/oxy-form-item/index.scss +18 -0
- package/components/oxy-form-item/oxy-form-item.vue +56 -0
- package/components/oxy-form-item/types.ts +16 -0
- package/components/oxy-gap/index.scss +9 -0
- package/components/oxy-gap/oxy-gap.vue +36 -0
- package/components/oxy-gap/types.ts +17 -0
- package/components/oxy-grid/index.scss +9 -0
- package/components/oxy-grid/oxy-grid.vue +106 -0
- package/components/oxy-grid/types.ts +50 -0
- package/components/oxy-grid-item/index.scss +148 -0
- package/components/oxy-grid-item/oxy-grid-item.vue +176 -0
- package/components/oxy-grid-item/types.ts +77 -0
- package/components/oxy-icon/index.scss +1230 -0
- package/components/oxy-icon/oxy-icon.vue +53 -0
- package/components/oxy-icon/oxy-icons.ttf +0 -0
- package/components/oxy-icon/types.ts +21 -0
- package/components/oxy-img/index.scss +19 -0
- package/components/oxy-img/oxy-img.vue +81 -0
- package/components/oxy-img/types.ts +61 -0
- package/components/oxy-img-cropper/index.scss +231 -0
- package/components/oxy-img-cropper/oxy-img-cropper.vue +664 -0
- package/components/oxy-img-cropper/types.ts +76 -0
- package/components/oxy-index-anchor/index.scss +35 -0
- package/components/oxy-index-anchor/oxy-index-anchor.vue +55 -0
- package/components/oxy-index-anchor/type.ts +9 -0
- package/components/oxy-index-bar/index.scss +39 -0
- package/components/oxy-index-bar/oxy-index-bar.vue +156 -0
- package/components/oxy-index-bar/type.ts +23 -0
- package/components/oxy-input/index.scss +323 -0
- package/components/oxy-input/oxy-input.vue +300 -0
- package/components/oxy-input/placeholder.scss +21 -0
- package/components/oxy-input/types.ts +189 -0
- package/components/oxy-input-number/index.scss +132 -0
- package/components/oxy-input-number/oxy-input-number.vue +464 -0
- package/components/oxy-input-number/types.ts +101 -0
- package/components/oxy-keyboard/constants.ts +81 -0
- package/components/oxy-keyboard/index.scss +102 -0
- package/components/oxy-keyboard/key/index.scss +79 -0
- package/components/oxy-keyboard/key/index.vue +76 -0
- package/components/oxy-keyboard/key/types.ts +11 -0
- package/components/oxy-keyboard/oxy-keyboard.vue +206 -0
- package/components/oxy-keyboard/types.ts +92 -0
- package/components/oxy-loading/index.scss +37 -0
- package/components/oxy-loading/oxy-loading.vue +90 -0
- package/components/oxy-loading/types.ts +22 -0
- package/components/oxy-loadmore/index.scss +39 -0
- package/components/oxy-loadmore/oxy-loadmore.vue +59 -0
- package/components/oxy-loadmore/types.ts +30 -0
- package/components/oxy-message-box/index.scss +108 -0
- package/components/oxy-message-box/index.ts +87 -0
- package/components/oxy-message-box/oxy-message-box.vue +291 -0
- package/components/oxy-message-box/types.ts +132 -0
- package/components/oxy-navbar/index.scss +93 -0
- package/components/oxy-navbar/oxy-navbar.vue +111 -0
- package/components/oxy-navbar/types.ts +52 -0
- package/components/oxy-navbar-capsule/index.scss +66 -0
- package/components/oxy-navbar-capsule/oxy-navbar-capsule.vue +35 -0
- package/components/oxy-navbar-capsule/types.ts +8 -0
- package/components/oxy-notice-bar/index.scss +68 -0
- package/components/oxy-notice-bar/oxy-notice-bar.vue +266 -0
- package/components/oxy-notice-bar/types.ts +67 -0
- package/components/oxy-notify/index.scss +34 -0
- package/components/oxy-notify/index.ts +61 -0
- package/components/oxy-notify/oxy-notify.vue +85 -0
- package/components/oxy-notify/types.ts +66 -0
- package/components/oxy-number-keyboard/index.scss +78 -0
- package/components/oxy-number-keyboard/key/index.scss +81 -0
- package/components/oxy-number-keyboard/key/index.vue +78 -0
- package/components/oxy-number-keyboard/key/types.ts +11 -0
- package/components/oxy-number-keyboard/oxy-number-keyboard.vue +151 -0
- package/components/oxy-number-keyboard/types.ts +83 -0
- package/components/oxy-overlay/index.scss +17 -0
- package/components/oxy-overlay/oxy-overlay.vue +47 -0
- package/components/oxy-overlay/types.ts +25 -0
- package/components/oxy-pagination/index.scss +57 -0
- package/components/oxy-pagination/oxy-pagination.vue +110 -0
- package/components/oxy-pagination/types.ts +41 -0
- package/components/oxy-password-input/index.scss +124 -0
- package/components/oxy-password-input/oxy-password-input.vue +49 -0
- package/components/oxy-password-input/types.ts +33 -0
- package/components/oxy-picker/index.scss +110 -0
- package/components/oxy-picker/oxy-picker.vue +412 -0
- package/components/oxy-picker/types.ts +189 -0
- package/components/oxy-picker-view/index.scss +92 -0
- package/components/oxy-picker-view/oxy-picker-view.vue +369 -0
- package/components/oxy-picker-view/types.ts +152 -0
- package/components/oxy-popover/index.scss +116 -0
- package/components/oxy-popover/oxy-popover.vue +180 -0
- package/components/oxy-popover/types.ts +69 -0
- package/components/oxy-popup/index.scss +84 -0
- package/components/oxy-popup/oxy-popup.vue +169 -0
- package/components/oxy-popup/types.ts +95 -0
- package/components/oxy-progress/index.scss +68 -0
- package/components/oxy-progress/oxy-progress.vue +197 -0
- package/components/oxy-progress/types.ts +35 -0
- package/components/oxy-radio/index.scss +301 -0
- package/components/oxy-radio/oxy-radio.vue +118 -0
- package/components/oxy-radio/types.ts +42 -0
- package/components/oxy-radio-group/index.scss +23 -0
- package/components/oxy-radio-group/oxy-radio-group.vue +51 -0
- package/components/oxy-radio-group/types.ts +39 -0
- package/components/oxy-rate/index.scss +25 -0
- package/components/oxy-rate/oxy-rate.vue +178 -0
- package/components/oxy-rate/types.ts +103 -0
- package/components/oxy-resize/index.scss +27 -0
- package/components/oxy-resize/oxy-resize.vue +144 -0
- package/components/oxy-resize/types.ts +6 -0
- package/components/oxy-root-portal/oxy-root-portal.vue +50 -0
- package/components/oxy-row/index.scss +10 -0
- package/components/oxy-row/oxy-row.vue +42 -0
- package/components/oxy-row/types.ts +16 -0
- package/components/oxy-search/index.scss +148 -0
- package/components/oxy-search/oxy-search.vue +187 -0
- package/components/oxy-search/types.ts +93 -0
- package/components/oxy-segmented/index.scss +101 -0
- package/components/oxy-segmented/oxy-segmented.vue +143 -0
- package/components/oxy-segmented/types.ts +71 -0
- package/components/oxy-select-picker/index.scss +102 -0
- package/components/oxy-select-picker/oxy-select-picker.vue +432 -0
- package/components/oxy-select-picker/types.ts +123 -0
- package/components/oxy-sidebar/index.scss +25 -0
- package/components/oxy-sidebar/oxy-sidebar.vue +63 -0
- package/components/oxy-sidebar/types.ts +38 -0
- package/components/oxy-sidebar-item/index.scss +97 -0
- package/components/oxy-sidebar-item/oxy-sidebar-item.vue +116 -0
- package/components/oxy-sidebar-item/types.ts +31 -0
- package/components/oxy-signature/index.scss +31 -0
- package/components/oxy-signature/oxy-signature.vue +630 -0
- package/components/oxy-signature/types.ts +108 -0
- package/components/oxy-skeleton/index.scss +96 -0
- package/components/oxy-skeleton/index.ts +1 -0
- package/components/oxy-skeleton/oxy-skeleton.vue +110 -0
- package/components/oxy-skeleton/types.ts +69 -0
- package/components/oxy-slider/index.scss +98 -0
- package/components/oxy-slider/oxy-slider.vue +356 -0
- package/components/oxy-slider/types.ts +138 -0
- package/components/oxy-sort-button/index.scss +89 -0
- package/components/oxy-sort-button/oxy-sort-button.vue +69 -0
- package/components/oxy-sort-button/types.ts +43 -0
- package/components/oxy-status-tip/images/collect.png +0 -0
- package/components/oxy-status-tip/images/content.png +0 -0
- package/components/oxy-status-tip/images/network.png +0 -0
- package/components/oxy-status-tip/images/search.png +0 -0
- package/components/oxy-status-tip/index.scss +37 -0
- package/components/oxy-status-tip/oxy-status-tip.vue +71 -0
- package/components/oxy-status-tip/types.ts +50 -0
- package/components/oxy-step/index.scss +235 -0
- package/components/oxy-step/oxy-step.vue +150 -0
- package/components/oxy-step/types.ts +33 -0
- package/components/oxy-steps/index.scss +10 -0
- package/components/oxy-steps/oxy-steps.vue +28 -0
- package/components/oxy-steps/types.ts +50 -0
- package/components/oxy-sticky/index.scss +9 -0
- package/components/oxy-sticky/oxy-sticky.vue +190 -0
- package/components/oxy-sticky/types.ts +13 -0
- package/components/oxy-sticky-box/index.scss +6 -0
- package/components/oxy-sticky-box/oxy-sticky-box.vue +155 -0
- package/components/oxy-sticky-box/types.ts +11 -0
- package/components/oxy-swipe-action/index.scss +22 -0
- package/components/oxy-swipe-action/oxy-swipe-action.vue +294 -0
- package/components/oxy-swipe-action/types.ts +40 -0
- package/components/oxy-swiper/index.scss +53 -0
- package/components/oxy-swiper/oxy-swiper.vue +318 -0
- package/components/oxy-swiper/types.ts +264 -0
- package/components/oxy-swiper-nav/index.scss +159 -0
- package/components/oxy-swiper-nav/oxy-swiper-nav.vue +37 -0
- package/components/oxy-swiper-nav/types.ts +42 -0
- package/components/oxy-switch/index.scss +58 -0
- package/components/oxy-switch/oxy-switch.vue +83 -0
- package/components/oxy-switch/types.ts +58 -0
- package/components/oxy-tab/index.scss +16 -0
- package/components/oxy-tab/oxy-tab.vue +88 -0
- package/components/oxy-tab/types.ts +30 -0
- package/components/oxy-tabbar/index.scss +62 -0
- package/components/oxy-tabbar/oxy-tabbar.vue +91 -0
- package/components/oxy-tabbar/types.ts +73 -0
- package/components/oxy-tabbar-item/index.scss +55 -0
- package/components/oxy-tabbar-item/oxy-tabbar-item.vue +99 -0
- package/components/oxy-tabbar-item/types.ts +51 -0
- package/components/oxy-table/index.scss +163 -0
- package/components/oxy-table/oxy-table.vue +283 -0
- package/components/oxy-table/types.ts +58 -0
- package/components/oxy-table-col/index.scss +46 -0
- package/components/oxy-table-col/oxy-table-col.vue +149 -0
- package/components/oxy-table-col/types.ts +54 -0
- package/components/oxy-tabs/index.scss +299 -0
- package/components/oxy-tabs/oxy-tabs.vue +443 -0
- package/components/oxy-tabs/types.ts +107 -0
- package/components/oxy-tag/index.scss +115 -0
- package/components/oxy-tag/oxy-tag.vue +148 -0
- package/components/oxy-tag/types.ts +81 -0
- package/components/oxy-text/index.scss +37 -0
- package/components/oxy-text/oxy-text.vue +139 -0
- package/components/oxy-text/types.ts +98 -0
- package/components/oxy-textarea/index.scss +340 -0
- package/components/oxy-textarea/oxy-textarea.vue +296 -0
- package/components/oxy-textarea/placeholder.scss +20 -0
- package/components/oxy-textarea/types.ts +288 -0
- package/components/oxy-toast/index.scss +75 -0
- package/components/oxy-toast/index.ts +92 -0
- package/components/oxy-toast/oxy-toast.vue +198 -0
- package/components/oxy-toast/types.ts +181 -0
- package/components/oxy-tooltip/index.scss +66 -0
- package/components/oxy-tooltip/oxy-tooltip.vue +141 -0
- package/components/oxy-tooltip/types.ts +107 -0
- package/components/oxy-transition/index.scss +95 -0
- package/components/oxy-transition/oxy-transition.vue +232 -0
- package/components/oxy-transition/types.ts +98 -0
- package/components/oxy-upload/index.scss +175 -0
- package/components/oxy-upload/oxy-upload.vue +673 -0
- package/components/oxy-upload/types.ts +391 -0
- package/components/oxy-video-preview/index.scss +34 -0
- package/components/oxy-video-preview/oxy-video-preview.vue +72 -0
- package/components/oxy-video-preview/types.ts +23 -0
- package/components/oxy-watermark/index.scss +18 -0
- package/components/oxy-watermark/oxy-watermark.vue +486 -0
- package/components/oxy-watermark/types.ts +76 -0
- package/dayjs/constant.js +26 -0
- package/dayjs/index.d.ts +430 -0
- package/dayjs/index.js +542 -0
- package/dayjs/locale/en.js +13 -0
- package/dayjs/utils.js +59 -0
- package/global.d.ts +101 -0
- package/index.ts +12 -0
- package/locale/index.ts +32 -0
- package/locale/lang/ar-SA.ts +133 -0
- package/locale/lang/en-US.ts +133 -0
- package/locale/lang/zh-CN.ts +137 -0
- package/package.json +1 -0
- package/tags.json +1 -0
- package/web-types.json +1 -0
package/dayjs/index.js
ADDED
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as C from './constant';
|
|
3
|
+
import en from './locale/en';
|
|
4
|
+
import U from './utils';
|
|
5
|
+
var L = 'en'; // global locale
|
|
6
|
+
|
|
7
|
+
var Ls = {}; // global loaded locale
|
|
8
|
+
|
|
9
|
+
Ls[L] = en;
|
|
10
|
+
var IS_DAYJS = '$isDayjsObject'; // eslint-disable-next-line no-use-before-define
|
|
11
|
+
|
|
12
|
+
var isDayjs = function isDayjs(d) {
|
|
13
|
+
return d instanceof Dayjs || !!(d && d[IS_DAYJS]);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
var parseLocale = function parseLocale(preset, object, isLocal) {
|
|
17
|
+
var l;
|
|
18
|
+
if (!preset) return L;
|
|
19
|
+
|
|
20
|
+
if (typeof preset === 'string') {
|
|
21
|
+
var presetLower = preset.toLowerCase();
|
|
22
|
+
|
|
23
|
+
if (Ls[presetLower]) {
|
|
24
|
+
l = presetLower;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (object) {
|
|
28
|
+
Ls[presetLower] = object;
|
|
29
|
+
l = presetLower;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var presetSplit = preset.split('-');
|
|
33
|
+
|
|
34
|
+
if (!l && presetSplit.length > 1) {
|
|
35
|
+
return parseLocale(presetSplit[0]);
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
var name = preset.name;
|
|
39
|
+
Ls[name] = preset;
|
|
40
|
+
l = name;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!isLocal && l) L = l;
|
|
44
|
+
return l || !isLocal && L;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var dayjs = function dayjs(date, c) {
|
|
48
|
+
if (isDayjs(date)) {
|
|
49
|
+
return date.clone();
|
|
50
|
+
} // eslint-disable-next-line no-nested-ternary
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
var cfg = typeof c === 'object' ? c : {};
|
|
54
|
+
cfg.date = date;
|
|
55
|
+
cfg.args = arguments; // eslint-disable-line prefer-rest-params
|
|
56
|
+
|
|
57
|
+
return new Dayjs(cfg); // eslint-disable-line no-use-before-define
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var wrapper = function wrapper(date, instance) {
|
|
61
|
+
return dayjs(date, {
|
|
62
|
+
locale: instance.$L,
|
|
63
|
+
utc: instance.$u,
|
|
64
|
+
x: instance.$x,
|
|
65
|
+
$offset: instance.$offset // todo: refactor; do not use this.$offset in you code
|
|
66
|
+
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var Utils = U; // for plugin use
|
|
71
|
+
|
|
72
|
+
Utils.l = parseLocale;
|
|
73
|
+
Utils.i = isDayjs;
|
|
74
|
+
Utils.w = wrapper;
|
|
75
|
+
|
|
76
|
+
var parseDate = function parseDate(cfg) {
|
|
77
|
+
var date = cfg.date,
|
|
78
|
+
utc = cfg.utc;
|
|
79
|
+
if (date === null) return new Date(NaN); // null is invalid
|
|
80
|
+
|
|
81
|
+
if (Utils.u(date)) return new Date(); // today
|
|
82
|
+
|
|
83
|
+
if (date instanceof Date) return new Date(date);
|
|
84
|
+
|
|
85
|
+
if (typeof date === 'string' && !/Z$/i.test(date)) {
|
|
86
|
+
var d = date.match(C.REGEX_PARSE);
|
|
87
|
+
|
|
88
|
+
if (d) {
|
|
89
|
+
var m = d[2] - 1 || 0;
|
|
90
|
+
var ms = (d[7] || '0').substring(0, 3);
|
|
91
|
+
|
|
92
|
+
if (utc) {
|
|
93
|
+
return new Date(Date.UTC(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return new Date(d[1], m, d[3] || 1, d[4] || 0, d[5] || 0, d[6] || 0, ms);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return new Date(date); // everything else
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var Dayjs = /*#__PURE__*/function () {
|
|
104
|
+
function Dayjs(cfg) {
|
|
105
|
+
this.$L = parseLocale(cfg.locale, null, true);
|
|
106
|
+
this.parse(cfg); // for plugin
|
|
107
|
+
|
|
108
|
+
this.$x = this.$x || cfg.x || {};
|
|
109
|
+
this[IS_DAYJS] = true;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
var _proto = Dayjs.prototype;
|
|
113
|
+
|
|
114
|
+
_proto.parse = function parse(cfg) {
|
|
115
|
+
this.$d = parseDate(cfg);
|
|
116
|
+
this.init();
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
_proto.init = function init() {
|
|
120
|
+
var $d = this.$d;
|
|
121
|
+
this.$y = $d.getFullYear();
|
|
122
|
+
this.$M = $d.getMonth();
|
|
123
|
+
this.$D = $d.getDate();
|
|
124
|
+
this.$W = $d.getDay();
|
|
125
|
+
this.$H = $d.getHours();
|
|
126
|
+
this.$m = $d.getMinutes();
|
|
127
|
+
this.$s = $d.getSeconds();
|
|
128
|
+
this.$ms = $d.getMilliseconds();
|
|
129
|
+
} // eslint-disable-next-line class-methods-use-this
|
|
130
|
+
;
|
|
131
|
+
|
|
132
|
+
_proto.$utils = function $utils() {
|
|
133
|
+
return Utils;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
_proto.isValid = function isValid() {
|
|
137
|
+
return !(this.$d.toString() === C.INVALID_DATE_STRING);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
_proto.isSame = function isSame(that, units) {
|
|
141
|
+
var other = dayjs(that);
|
|
142
|
+
return this.startOf(units) <= other && other <= this.endOf(units);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
_proto.isAfter = function isAfter(that, units) {
|
|
146
|
+
return dayjs(that) < this.startOf(units);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
_proto.isBefore = function isBefore(that, units) {
|
|
150
|
+
return this.endOf(units) < dayjs(that);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
_proto.$g = function $g(input, get, set) {
|
|
154
|
+
if (Utils.u(input)) return this[get];
|
|
155
|
+
return this.set(set, input);
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
_proto.unix = function unix() {
|
|
159
|
+
return Math.floor(this.valueOf() / 1000);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
_proto.valueOf = function valueOf() {
|
|
163
|
+
// timezone(hour) * 60 * 60 * 1000 => ms
|
|
164
|
+
return this.$d.getTime();
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
_proto.startOf = function startOf(units, _startOf) {
|
|
168
|
+
var _this = this;
|
|
169
|
+
|
|
170
|
+
// startOf -> endOf
|
|
171
|
+
var isStartOf = !Utils.u(_startOf) ? _startOf : true;
|
|
172
|
+
var unit = Utils.p(units);
|
|
173
|
+
|
|
174
|
+
var instanceFactory = function instanceFactory(d, m) {
|
|
175
|
+
var ins = Utils.w(_this.$u ? Date.UTC(_this.$y, m, d) : new Date(_this.$y, m, d), _this);
|
|
176
|
+
return isStartOf ? ins : ins.endOf(C.D);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
var instanceFactorySet = function instanceFactorySet(method, slice) {
|
|
180
|
+
var argumentStart = [0, 0, 0, 0];
|
|
181
|
+
var argumentEnd = [23, 59, 59, 999];
|
|
182
|
+
return Utils.w(_this.toDate()[method].apply( // eslint-disable-line prefer-spread
|
|
183
|
+
_this.toDate('s'), (isStartOf ? argumentStart : argumentEnd).slice(slice)), _this);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
var $W = this.$W,
|
|
187
|
+
$M = this.$M,
|
|
188
|
+
$D = this.$D;
|
|
189
|
+
var utcPad = "set" + (this.$u ? 'UTC' : '');
|
|
190
|
+
|
|
191
|
+
switch (unit) {
|
|
192
|
+
case C.Y:
|
|
193
|
+
return isStartOf ? instanceFactory(1, 0) : instanceFactory(31, 11);
|
|
194
|
+
|
|
195
|
+
case C.M:
|
|
196
|
+
return isStartOf ? instanceFactory(1, $M) : instanceFactory(0, $M + 1);
|
|
197
|
+
|
|
198
|
+
case C.W:
|
|
199
|
+
{
|
|
200
|
+
var weekStart = this.$locale().weekStart || 0;
|
|
201
|
+
var gap = ($W < weekStart ? $W + 7 : $W) - weekStart;
|
|
202
|
+
return instanceFactory(isStartOf ? $D - gap : $D + (6 - gap), $M);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
case C.D:
|
|
206
|
+
case C.DATE:
|
|
207
|
+
return instanceFactorySet(utcPad + "Hours", 0);
|
|
208
|
+
|
|
209
|
+
case C.H:
|
|
210
|
+
return instanceFactorySet(utcPad + "Minutes", 1);
|
|
211
|
+
|
|
212
|
+
case C.MIN:
|
|
213
|
+
return instanceFactorySet(utcPad + "Seconds", 2);
|
|
214
|
+
|
|
215
|
+
case C.S:
|
|
216
|
+
return instanceFactorySet(utcPad + "Milliseconds", 3);
|
|
217
|
+
|
|
218
|
+
default:
|
|
219
|
+
return this.clone();
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
_proto.endOf = function endOf(arg) {
|
|
224
|
+
return this.startOf(arg, false);
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
_proto.$set = function $set(units, _int) {
|
|
228
|
+
var _C$D$C$DATE$C$M$C$Y$C;
|
|
229
|
+
|
|
230
|
+
// private set
|
|
231
|
+
var unit = Utils.p(units);
|
|
232
|
+
var utcPad = "set" + (this.$u ? 'UTC' : '');
|
|
233
|
+
var name = (_C$D$C$DATE$C$M$C$Y$C = {}, _C$D$C$DATE$C$M$C$Y$C[C.D] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[C.DATE] = utcPad + "Date", _C$D$C$DATE$C$M$C$Y$C[C.M] = utcPad + "Month", _C$D$C$DATE$C$M$C$Y$C[C.Y] = utcPad + "FullYear", _C$D$C$DATE$C$M$C$Y$C[C.H] = utcPad + "Hours", _C$D$C$DATE$C$M$C$Y$C[C.MIN] = utcPad + "Minutes", _C$D$C$DATE$C$M$C$Y$C[C.S] = utcPad + "Seconds", _C$D$C$DATE$C$M$C$Y$C[C.MS] = utcPad + "Milliseconds", _C$D$C$DATE$C$M$C$Y$C)[unit];
|
|
234
|
+
var arg = unit === C.D ? this.$D + (_int - this.$W) : _int;
|
|
235
|
+
|
|
236
|
+
if (unit === C.M || unit === C.Y) {
|
|
237
|
+
// clone is for badMutable plugin
|
|
238
|
+
var date = this.clone().set(C.DATE, 1);
|
|
239
|
+
date.$d[name](arg);
|
|
240
|
+
date.init();
|
|
241
|
+
this.$d = date.set(C.DATE, Math.min(this.$D, date.daysInMonth())).$d;
|
|
242
|
+
} else if (name) this.$d[name](arg);
|
|
243
|
+
|
|
244
|
+
this.init();
|
|
245
|
+
return this;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
_proto.set = function set(string, _int2) {
|
|
249
|
+
return this.clone().$set(string, _int2);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
_proto.get = function get(unit) {
|
|
253
|
+
return this[Utils.p(unit)]();
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
_proto.add = function add(number, units) {
|
|
257
|
+
var _this2 = this,
|
|
258
|
+
_C$MIN$C$H$C$S$unit;
|
|
259
|
+
|
|
260
|
+
number = Number(number); // eslint-disable-line no-param-reassign
|
|
261
|
+
|
|
262
|
+
var unit = Utils.p(units);
|
|
263
|
+
|
|
264
|
+
var instanceFactorySet = function instanceFactorySet(n) {
|
|
265
|
+
var d = dayjs(_this2);
|
|
266
|
+
return Utils.w(d.date(d.date() + Math.round(n * number)), _this2);
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
if (unit === C.M) {
|
|
270
|
+
return this.set(C.M, this.$M + number);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (unit === C.Y) {
|
|
274
|
+
return this.set(C.Y, this.$y + number);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (unit === C.D) {
|
|
278
|
+
return instanceFactorySet(1);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (unit === C.W) {
|
|
282
|
+
return instanceFactorySet(7);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
var step = (_C$MIN$C$H$C$S$unit = {}, _C$MIN$C$H$C$S$unit[C.MIN] = C.MILLISECONDS_A_MINUTE, _C$MIN$C$H$C$S$unit[C.H] = C.MILLISECONDS_A_HOUR, _C$MIN$C$H$C$S$unit[C.S] = C.MILLISECONDS_A_SECOND, _C$MIN$C$H$C$S$unit)[unit] || 1; // ms
|
|
286
|
+
|
|
287
|
+
var nextTimeStamp = this.$d.getTime() + number * step;
|
|
288
|
+
return Utils.w(nextTimeStamp, this);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
_proto.subtract = function subtract(number, string) {
|
|
292
|
+
return this.add(number * -1, string);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
_proto.format = function format(formatStr) {
|
|
296
|
+
var _this3 = this;
|
|
297
|
+
|
|
298
|
+
var locale = this.$locale();
|
|
299
|
+
if (!this.isValid()) return locale.invalidDate || C.INVALID_DATE_STRING;
|
|
300
|
+
var str = formatStr || C.FORMAT_DEFAULT;
|
|
301
|
+
var zoneStr = Utils.z(this);
|
|
302
|
+
var $H = this.$H,
|
|
303
|
+
$m = this.$m,
|
|
304
|
+
$M = this.$M;
|
|
305
|
+
var weekdays = locale.weekdays,
|
|
306
|
+
months = locale.months,
|
|
307
|
+
meridiem = locale.meridiem;
|
|
308
|
+
|
|
309
|
+
var getShort = function getShort(arr, index, full, length) {
|
|
310
|
+
return arr && (arr[index] || arr(_this3, str)) || full[index].slice(0, length);
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
var get$H = function get$H(num) {
|
|
314
|
+
return Utils.s($H % 12 || 12, num, '0');
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
var meridiemFunc = meridiem || function (hour, minute, isLowercase) {
|
|
318
|
+
var m = hour < 12 ? 'AM' : 'PM';
|
|
319
|
+
return isLowercase ? m.toLowerCase() : m;
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
var matches = function matches(match) {
|
|
323
|
+
switch (match) {
|
|
324
|
+
case 'YY':
|
|
325
|
+
return String(_this3.$y).slice(-2);
|
|
326
|
+
|
|
327
|
+
case 'YYYY':
|
|
328
|
+
return Utils.s(_this3.$y, 4, '0');
|
|
329
|
+
|
|
330
|
+
case 'M':
|
|
331
|
+
return $M + 1;
|
|
332
|
+
|
|
333
|
+
case 'MM':
|
|
334
|
+
return Utils.s($M + 1, 2, '0');
|
|
335
|
+
|
|
336
|
+
case 'MMM':
|
|
337
|
+
return getShort(locale.monthsShort, $M, months, 3);
|
|
338
|
+
|
|
339
|
+
case 'MMMM':
|
|
340
|
+
return getShort(months, $M);
|
|
341
|
+
|
|
342
|
+
case 'D':
|
|
343
|
+
return _this3.$D;
|
|
344
|
+
|
|
345
|
+
case 'DD':
|
|
346
|
+
return Utils.s(_this3.$D, 2, '0');
|
|
347
|
+
|
|
348
|
+
case 'd':
|
|
349
|
+
return String(_this3.$W);
|
|
350
|
+
|
|
351
|
+
case 'dd':
|
|
352
|
+
return getShort(locale.weekdaysMin, _this3.$W, weekdays, 2);
|
|
353
|
+
|
|
354
|
+
case 'ddd':
|
|
355
|
+
return getShort(locale.weekdaysShort, _this3.$W, weekdays, 3);
|
|
356
|
+
|
|
357
|
+
case 'dddd':
|
|
358
|
+
return weekdays[_this3.$W];
|
|
359
|
+
|
|
360
|
+
case 'H':
|
|
361
|
+
return String($H);
|
|
362
|
+
|
|
363
|
+
case 'HH':
|
|
364
|
+
return Utils.s($H, 2, '0');
|
|
365
|
+
|
|
366
|
+
case 'h':
|
|
367
|
+
return get$H(1);
|
|
368
|
+
|
|
369
|
+
case 'hh':
|
|
370
|
+
return get$H(2);
|
|
371
|
+
|
|
372
|
+
case 'a':
|
|
373
|
+
return meridiemFunc($H, $m, true);
|
|
374
|
+
|
|
375
|
+
case 'A':
|
|
376
|
+
return meridiemFunc($H, $m, false);
|
|
377
|
+
|
|
378
|
+
case 'm':
|
|
379
|
+
return String($m);
|
|
380
|
+
|
|
381
|
+
case 'mm':
|
|
382
|
+
return Utils.s($m, 2, '0');
|
|
383
|
+
|
|
384
|
+
case 's':
|
|
385
|
+
return String(_this3.$s);
|
|
386
|
+
|
|
387
|
+
case 'ss':
|
|
388
|
+
return Utils.s(_this3.$s, 2, '0');
|
|
389
|
+
|
|
390
|
+
case 'SSS':
|
|
391
|
+
return Utils.s(_this3.$ms, 3, '0');
|
|
392
|
+
|
|
393
|
+
case 'Z':
|
|
394
|
+
return zoneStr;
|
|
395
|
+
// 'ZZ' logic below
|
|
396
|
+
|
|
397
|
+
default:
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return null;
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
return str.replace(C.REGEX_FORMAT, function (match, $1) {
|
|
405
|
+
return $1 || matches(match) || zoneStr.replace(':', '');
|
|
406
|
+
}); // 'ZZ'
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
_proto.utcOffset = function utcOffset() {
|
|
410
|
+
// Because a bug at FF24, we're rounding the timezone offset around 15 minutes
|
|
411
|
+
// https://github.com/moment/moment/pull/1871
|
|
412
|
+
return -Math.round(this.$d.getTimezoneOffset() / 15) * 15;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
_proto.diff = function diff(input, units, _float) {
|
|
416
|
+
var _this4 = this;
|
|
417
|
+
|
|
418
|
+
var unit = Utils.p(units);
|
|
419
|
+
var that = dayjs(input);
|
|
420
|
+
var zoneDelta = (that.utcOffset() - this.utcOffset()) * C.MILLISECONDS_A_MINUTE;
|
|
421
|
+
var diff = this - that;
|
|
422
|
+
|
|
423
|
+
var getMonth = function getMonth() {
|
|
424
|
+
return Utils.m(_this4, that);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
var result;
|
|
428
|
+
|
|
429
|
+
switch (unit) {
|
|
430
|
+
case C.Y:
|
|
431
|
+
result = getMonth() / 12;
|
|
432
|
+
break;
|
|
433
|
+
|
|
434
|
+
case C.M:
|
|
435
|
+
result = getMonth();
|
|
436
|
+
break;
|
|
437
|
+
|
|
438
|
+
case C.Q:
|
|
439
|
+
result = getMonth() / 3;
|
|
440
|
+
break;
|
|
441
|
+
|
|
442
|
+
case C.W:
|
|
443
|
+
result = (diff - zoneDelta) / C.MILLISECONDS_A_WEEK;
|
|
444
|
+
break;
|
|
445
|
+
|
|
446
|
+
case C.D:
|
|
447
|
+
result = (diff - zoneDelta) / C.MILLISECONDS_A_DAY;
|
|
448
|
+
break;
|
|
449
|
+
|
|
450
|
+
case C.H:
|
|
451
|
+
result = diff / C.MILLISECONDS_A_HOUR;
|
|
452
|
+
break;
|
|
453
|
+
|
|
454
|
+
case C.MIN:
|
|
455
|
+
result = diff / C.MILLISECONDS_A_MINUTE;
|
|
456
|
+
break;
|
|
457
|
+
|
|
458
|
+
case C.S:
|
|
459
|
+
result = diff / C.MILLISECONDS_A_SECOND;
|
|
460
|
+
break;
|
|
461
|
+
|
|
462
|
+
default:
|
|
463
|
+
result = diff; // milliseconds
|
|
464
|
+
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return _float ? result : Utils.a(result);
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
_proto.daysInMonth = function daysInMonth() {
|
|
472
|
+
return this.endOf(C.M).$D;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
_proto.$locale = function $locale() {
|
|
476
|
+
// get locale object
|
|
477
|
+
return Ls[this.$L];
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
_proto.locale = function locale(preset, object) {
|
|
481
|
+
if (!preset) return this.$L;
|
|
482
|
+
var that = this.clone();
|
|
483
|
+
var nextLocaleName = parseLocale(preset, object, true);
|
|
484
|
+
if (nextLocaleName) that.$L = nextLocaleName;
|
|
485
|
+
return that;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
_proto.clone = function clone() {
|
|
489
|
+
return Utils.w(this.$d, this);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
_proto.toDate = function toDate() {
|
|
493
|
+
return new Date(this.valueOf());
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
_proto.toJSON = function toJSON() {
|
|
497
|
+
return this.isValid() ? this.toISOString() : null;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
_proto.toISOString = function toISOString() {
|
|
501
|
+
// ie 8 return
|
|
502
|
+
// new Dayjs(this.valueOf() + this.$d.getTimezoneOffset() * 60000)
|
|
503
|
+
// .format('YYYY-MM-DDTHH:mm:ss.SSS[Z]')
|
|
504
|
+
return this.$d.toISOString();
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
_proto.toString = function toString() {
|
|
508
|
+
return this.$d.toUTCString();
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
return Dayjs;
|
|
512
|
+
}();
|
|
513
|
+
|
|
514
|
+
var proto = Dayjs.prototype;
|
|
515
|
+
dayjs.prototype = proto;
|
|
516
|
+
[['$ms', C.MS], ['$s', C.S], ['$m', C.MIN], ['$H', C.H], ['$W', C.D], ['$M', C.M], ['$y', C.Y], ['$D', C.DATE]].forEach(function (g) {
|
|
517
|
+
proto[g[1]] = function (input) {
|
|
518
|
+
return this.$g(input, g[0], g[1]);
|
|
519
|
+
};
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
dayjs.extend = function (plugin, option) {
|
|
523
|
+
if (!plugin.$i) {
|
|
524
|
+
// install plugin only once
|
|
525
|
+
plugin(option, Dayjs, dayjs);
|
|
526
|
+
plugin.$i = true;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
return dayjs;
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
dayjs.locale = parseLocale;
|
|
533
|
+
dayjs.isDayjs = isDayjs;
|
|
534
|
+
|
|
535
|
+
dayjs.unix = function (timestamp) {
|
|
536
|
+
return dayjs(timestamp * 1e3);
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
dayjs.en = Ls[L];
|
|
540
|
+
dayjs.Ls = Ls;
|
|
541
|
+
dayjs.p = {};
|
|
542
|
+
export default dayjs;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// English [en]
|
|
3
|
+
// We don't need weekdaysShort, weekdaysMin, monthsShort in en.js locale
|
|
4
|
+
export default {
|
|
5
|
+
name: 'en',
|
|
6
|
+
weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
|
|
7
|
+
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
|
|
8
|
+
ordinal: function ordinal(n) {
|
|
9
|
+
var s = ['th', 'st', 'nd', 'rd'];
|
|
10
|
+
var v = n % 100;
|
|
11
|
+
return "[" + n + (s[(v - 20) % 10] || s[v] || s[0]) + "]";
|
|
12
|
+
}
|
|
13
|
+
};
|
package/dayjs/utils.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import * as C from './constant';
|
|
3
|
+
|
|
4
|
+
var padStart = function padStart(string, length, pad) {
|
|
5
|
+
var s = String(string);
|
|
6
|
+
if (!s || s.length >= length) return string;
|
|
7
|
+
return "" + Array(length + 1 - s.length).join(pad) + string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
var padZoneStr = function padZoneStr(instance) {
|
|
11
|
+
var negMinutes = -instance.utcOffset();
|
|
12
|
+
var minutes = Math.abs(negMinutes);
|
|
13
|
+
var hourOffset = Math.floor(minutes / 60);
|
|
14
|
+
var minuteOffset = minutes % 60;
|
|
15
|
+
return "" + (negMinutes <= 0 ? '+' : '-') + padStart(hourOffset, 2, '0') + ":" + padStart(minuteOffset, 2, '0');
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var monthDiff = function monthDiff(a, b) {
|
|
19
|
+
// function from moment.js in order to keep the same result
|
|
20
|
+
if (a.date() < b.date()) return -monthDiff(b, a);
|
|
21
|
+
var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month());
|
|
22
|
+
var anchor = a.clone().add(wholeMonthDiff, C.M);
|
|
23
|
+
var c = b - anchor < 0;
|
|
24
|
+
var anchor2 = a.clone().add(wholeMonthDiff + (c ? -1 : 1), C.M);
|
|
25
|
+
return +(-(wholeMonthDiff + (b - anchor) / (c ? anchor - anchor2 : anchor2 - anchor)) || 0);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var absFloor = function absFloor(n) {
|
|
29
|
+
return n < 0 ? Math.ceil(n) || 0 : Math.floor(n);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var prettyUnit = function prettyUnit(u) {
|
|
33
|
+
var special = {
|
|
34
|
+
M: C.M,
|
|
35
|
+
y: C.Y,
|
|
36
|
+
w: C.W,
|
|
37
|
+
d: C.D,
|
|
38
|
+
D: C.DATE,
|
|
39
|
+
h: C.H,
|
|
40
|
+
m: C.MIN,
|
|
41
|
+
s: C.S,
|
|
42
|
+
ms: C.MS,
|
|
43
|
+
Q: C.Q
|
|
44
|
+
};
|
|
45
|
+
return special[u] || String(u || '').toLowerCase().replace(/s$/, '');
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var isUndefined = function isUndefined(s) {
|
|
49
|
+
return s === undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default {
|
|
53
|
+
s: padStart,
|
|
54
|
+
z: padZoneStr,
|
|
55
|
+
m: monthDiff,
|
|
56
|
+
a: absFloor,
|
|
57
|
+
p: prettyUnit,
|
|
58
|
+
u: isUndefined
|
|
59
|
+
};
|