@kengic/uni 0.5.1 → 0.5.2-beta.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/dist/uni/uni-ui/uni-badge/uni-badge.vue +222 -219
- package/dist/uni/uni-ui/uni-breadcrumb/uni-breadcrumb.vue +29 -29
- package/dist/uni/uni-ui/uni-breadcrumb-item/uni-breadcrumb-item.vue +88 -88
- package/dist/uni/uni-ui/uni-calendar/calendar.js +936 -532
- package/dist/uni/uni-ui/uni-calendar/i18n/en.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hans.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/i18n/zh-Hant.json +10 -10
- package/dist/uni/uni-ui/uni-calendar/uni-calendar-item.vue +190 -168
- package/dist/uni/uni-ui/uni-calendar/uni-calendar.vue +459 -459
- package/dist/uni/uni-ui/uni-calendar/util.js +324 -340
- package/dist/uni/uni-ui/uni-card/uni-card.vue +8 -1
- package/dist/uni/uni-ui/uni-col/uni-col.vue +294 -287
- package/dist/uni/uni-ui/uni-collapse/uni-collapse.vue +139 -140
- package/dist/uni/uni-ui/uni-collapse-item/uni-collapse-item.vue +381 -378
- package/dist/uni/uni-ui/uni-combox/uni-combox.vue +280 -272
- package/dist/uni/uni-ui/uni-countdown/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-countdown/uni-countdown.vue +249 -257
- package/dist/uni/uni-ui/uni-data-checkbox/uni-data-checkbox.vue +832 -813
- package/dist/uni/uni-ui/uni-data-picker/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-data-picker/uni-data-picker.vue +535 -516
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-picker.js +623 -618
- package/dist/uni/uni-ui/uni-data-pickerview/uni-data-pickerview.vue +293 -288
- package/dist/uni/uni-ui/uni-data-select/uni-data-select.vue +495 -509
- package/dist/uni/uni-ui/uni-dateformat/date-format.js +181 -184
- package/dist/uni/uni-ui/uni-dateformat/uni-dateformat.vue +81 -82
- package/dist/uni/uni-ui/uni-datetime-picker/calendar-item.vue +176 -170
- package/dist/uni/uni-ui/uni-datetime-picker/calendar.vue +926 -920
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/en.json +20 -20
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hans.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/i18n/zh-Hant.json +21 -21
- package/dist/uni/uni-ui/uni-datetime-picker/time-picker.vue +921 -926
- package/dist/uni/uni-ui/uni-datetime-picker/uni-datetime-picker.vue +1059 -1012
- package/dist/uni/uni-ui/uni-datetime-picker/util.js +366 -377
- package/dist/uni/uni-ui/uni-drawer/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-drawer/uni-drawer.vue +176 -167
- package/dist/uni/uni-ui/uni-easyinput/common.js +40 -42
- package/dist/uni/uni-ui/uni-easyinput/uni-easyinput.vue +628 -547
- package/dist/uni/uni-ui/uni-fab/uni-fab.vue +507 -483
- package/dist/uni/uni-ui/uni-fav/i18n/en.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-fav/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-fav/uni-fav.vue +155 -147
- package/dist/uni/uni-ui/uni-file-picker/choose-and-upload-file.js +172 -198
- package/dist/uni/uni-ui/uni-file-picker/uni-file-picker.vue +636 -634
- package/dist/uni/uni-ui/uni-file-picker/upload-file.vue +294 -293
- package/dist/uni/uni-ui/uni-file-picker/upload-image.vue +267 -270
- package/dist/uni/uni-ui/uni-file-picker/utils.js +81 -82
- package/dist/uni/uni-ui/uni-forms/uni-forms.vue +360 -372
- package/dist/uni/uni-ui/uni-forms/utils.js +170 -174
- package/dist/uni/uni-ui/uni-forms/validate.js +447 -456
- package/dist/uni/uni-ui/uni-forms-item/uni-forms-item.vue +497 -497
- package/dist/uni/uni-ui/uni-goods-nav/i18n/en.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hans.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/i18n/zh-Hant.json +4 -4
- package/dist/uni/uni-ui/uni-goods-nav/uni-goods-nav.vue +238 -222
- package/dist/uni/uni-ui/uni-grid/uni-grid.vue +134 -134
- package/dist/uni/uni-ui/uni-grid-item/uni-grid-item.vue +121 -119
- package/dist/uni/uni-ui/uni-group/uni-group.vue +121 -121
- package/dist/uni/uni-ui/uni-icons/icons.js +1170 -1168
- package/dist/uni/uni-ui/uni-icons/uni-icons.vue +91 -86
- package/dist/uni/uni-ui/uni-icons/uniicons.css +166 -166
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list-item.vue +129 -129
- package/dist/uni/uni-ui/uni-indexed-list/uni-indexed-list.vue +352 -347
- package/dist/uni/uni-ui/uni-link/uni-link.vue +134 -119
- package/dist/uni/uni-ui/uni-list/uni-list.vue +119 -110
- package/dist/uni/uni-ui/uni-list/uni-refresh.vue +14 -14
- package/dist/uni/uni-ui/uni-list/uni-refresh.wxs +14 -14
- package/dist/uni/uni-ui/uni-list-ad/uni-list-ad.vue +101 -95
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.scss +18 -18
- package/dist/uni/uni-ui/uni-list-chat/uni-list-chat.vue +602 -586
- package/dist/uni/uni-ui/uni-list-item/uni-list-item.vue +507 -503
- package/dist/uni/uni-ui/uni-load-more/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-load-more/uni-load-more.vue +402 -392
- package/dist/uni/uni-ui/uni-nav-bar/uni-nav-bar.vue +328 -330
- package/dist/uni/uni-ui/uni-nav-bar/uni-status-bar.vue +17 -17
- package/dist/uni/uni-ui/uni-notice-bar/uni-notice-bar.vue +422 -401
- package/dist/uni/uni-ui/uni-number-box/uni-number-box.vue +211 -205
- package/dist/uni/uni-ui/uni-pagination/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/es.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/fr.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/index.js +12 -11
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hans.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/i18n/zh-Hant.json +3 -3
- package/dist/uni/uni-ui/uni-pagination/uni-pagination.vue +450 -433
- package/dist/uni/uni-ui/uni-popup/uni-popup.vue +404 -404
- package/dist/uni/uni-ui/uni-popup-dialog/keypress.js +42 -42
- package/dist/uni/uni-ui/uni-popup-dialog/uni-popup-dialog.vue +1 -0
- package/dist/uni/uni-ui/uni-popup-message/uni-popup-message.vue +126 -125
- package/dist/uni/uni-ui/uni-popup-share/uni-popup-share.vue +172 -172
- package/dist/uni/uni-ui/uni-rate/uni-rate.vue +343 -347
- package/dist/uni/uni-ui/uni-row/uni-row.vue +180 -182
- package/dist/uni/uni-ui/uni-scss/changelog.md +11 -4
- package/dist/uni/uni-ui/uni-scss/package.json +73 -73
- package/dist/uni/uni-ui/uni-scss/readme.md +2 -1
- package/dist/uni/uni-ui/uni-scss/styles/setting/_border.scss +2 -2
- package/dist/uni/uni-ui/uni-scss/styles/setting/_color.scss +46 -47
- package/dist/uni/uni-ui/uni-scss/styles/setting/_radius.scss +49 -49
- package/dist/uni/uni-ui/uni-scss/styles/setting/_space.scss +52 -53
- package/dist/uni/uni-ui/uni-scss/styles/setting/_styles.scss +142 -147
- package/dist/uni/uni-ui/uni-scss/styles/setting/_text.scss +20 -20
- package/dist/uni/uni-ui/uni-scss/styles/setting/_variables.scss +111 -95
- package/dist/uni/uni-ui/uni-scss/styles/tools/functions.scss +28 -18
- package/dist/uni/uni-ui/uni-scss/theme.scss +10 -7
- package/dist/uni/uni-ui/uni-scss/variables.scss +42 -24
- package/dist/uni/uni-ui/uni-search-bar/i18n/en.json +3 -3
- package/dist/uni/uni-ui/uni-search-bar/i18n/index.js +8 -7
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hans.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/i18n/zh-Hant.json +2 -2
- package/dist/uni/uni-ui/uni-search-bar/uni-search-bar.vue +290 -281
- package/dist/uni/uni-ui/uni-section/uni-section.vue +149 -146
- package/dist/uni/uni-ui/uni-segmented-control/uni-segmented-control.vue +141 -131
- package/dist/uni/uni-ui/uni-steps/uni-steps.vue +255 -236
- package/dist/uni/uni-ui/uni-swipe-action/uni-swipe-action.vue +51 -51
- package/dist/uni/uni-ui/uni-swipe-action-item/bindingx.js +276 -282
- package/dist/uni/uni-ui/uni-swipe-action-item/isPC.js +10 -10
- package/dist/uni/uni-ui/uni-swipe-action-item/mpalipay.js +182 -187
- package/dist/uni/uni-ui/uni-swipe-action-item/mpother.js +235 -244
- package/dist/uni/uni-ui/uni-swipe-action-item/mpwxs.js +70 -75
- package/dist/uni/uni-ui/uni-swipe-action-item/render.js +238 -247
- package/dist/uni/uni-ui/uni-swipe-action-item/uni-swipe-action-item.vue +387 -313
- package/dist/uni/uni-ui/uni-swipe-action-item/wx.wxs +206 -215
- package/dist/uni/uni-ui/uni-swiper-dot/uni-swiper-dot.vue +241 -197
- package/dist/uni/uni-ui/uni-table/uni-table.vue +445 -447
- package/dist/uni/uni-ui/uni-tag/uni-tag.vue +234 -244
- package/dist/uni/uni-ui/uni-tbody/uni-tbody.vue +20 -23
- package/dist/uni/uni-ui/uni-td/uni-td.vue +79 -80
- package/dist/uni/uni-ui/uni-th/filter-dropdown.vue +510 -503
- package/dist/uni/uni-ui/uni-th/uni-th.vue +289 -273
- package/dist/uni/uni-ui/uni-thead/uni-thead.vue +115 -114
- package/dist/uni/uni-ui/uni-title/uni-title.vue +151 -154
- package/dist/uni/uni-ui/uni-tooltip/uni-tooltip.vue +55 -60
- package/dist/uni/uni-ui/uni-tr/table-checkbox.vue +162 -163
- package/dist/uni/uni-ui/uni-tr/uni-tr.vue +158 -157
- package/dist/uni/uni-ui/uni-transition/createAnimation.js +130 -113
- package/dist/uni/uni-ui/uni-transition/uni-transition.vue +274 -272
- package/package.json +1 -1
|
@@ -1,403 +1,392 @@
|
|
|
1
1
|
class Calendar {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// 多选状态
|
|
19
|
-
this.cleanMultipleStatus()
|
|
20
|
-
// 每周日期
|
|
21
|
-
this.weeks = {}
|
|
22
|
-
this.lastHover = false
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* 设置日期
|
|
26
|
-
* @param {Object} date
|
|
27
|
-
*/
|
|
28
|
-
setDate(date) {
|
|
29
|
-
const selectDate = this.getDateObj(date)
|
|
30
|
-
this.getWeeks(selectDate.fullDate)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 清理多选状态
|
|
35
|
-
*/
|
|
36
|
-
cleanMultipleStatus() {
|
|
37
|
-
this.multipleStatus = {
|
|
38
|
-
before: '',
|
|
39
|
-
after: '',
|
|
40
|
-
data: []
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
setStartDate(startDate) {
|
|
45
|
-
this.startDate = startDate
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
setEndDate(endDate) {
|
|
49
|
-
this.endDate = endDate
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
getPreMonthObj(date){
|
|
53
|
-
date = fixIosDateFormat(date)
|
|
54
|
-
date = new Date(date)
|
|
55
|
-
|
|
56
|
-
const oldMonth = date.getMonth()
|
|
57
|
-
date.setMonth(oldMonth - 1)
|
|
58
|
-
const newMonth = date.getMonth()
|
|
59
|
-
if(oldMonth !== 0 && newMonth - oldMonth === 0){
|
|
60
|
-
date.setMonth(newMonth - 1)
|
|
2
|
+
constructor({ selected, startDate, endDate, range } = {}) {
|
|
3
|
+
// 当前日期
|
|
4
|
+
this.date = this.getDateObj(new Date()); // 当前初入日期
|
|
5
|
+
// 打点信息
|
|
6
|
+
this.selected = selected || [];
|
|
7
|
+
// 起始时间
|
|
8
|
+
this.startDate = startDate;
|
|
9
|
+
// 终止时间
|
|
10
|
+
this.endDate = endDate;
|
|
11
|
+
// 是否范围选择
|
|
12
|
+
this.range = range;
|
|
13
|
+
// 多选状态
|
|
14
|
+
this.cleanMultipleStatus();
|
|
15
|
+
// 每周日期
|
|
16
|
+
this.weeks = {};
|
|
17
|
+
this.lastHover = false;
|
|
61
18
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
19
|
+
/**
|
|
20
|
+
* 设置日期
|
|
21
|
+
* @param {Object} date
|
|
22
|
+
*/
|
|
23
|
+
setDate(date) {
|
|
24
|
+
const selectDate = this.getDateObj(date);
|
|
25
|
+
this.getWeeks(selectDate.fullDate);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 清理多选状态
|
|
30
|
+
*/
|
|
31
|
+
cleanMultipleStatus() {
|
|
32
|
+
this.multipleStatus = {
|
|
33
|
+
before: '',
|
|
34
|
+
after: '',
|
|
35
|
+
data: [],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
setStartDate(startDate) {
|
|
40
|
+
this.startDate = startDate;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setEndDate(endDate) {
|
|
44
|
+
this.endDate = endDate;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getPreMonthObj(date) {
|
|
48
|
+
date = fixIosDateFormat(date);
|
|
49
|
+
date = new Date(date);
|
|
50
|
+
|
|
51
|
+
const oldMonth = date.getMonth();
|
|
52
|
+
date.setMonth(oldMonth - 1);
|
|
53
|
+
const newMonth = date.getMonth();
|
|
54
|
+
if (oldMonth !== 0 && newMonth - oldMonth === 0) {
|
|
55
|
+
date.setMonth(newMonth - 1);
|
|
56
|
+
}
|
|
57
|
+
return this.getDateObj(date);
|
|
58
|
+
}
|
|
59
|
+
getNextMonthObj(date) {
|
|
60
|
+
date = fixIosDateFormat(date);
|
|
61
|
+
date = new Date(date);
|
|
62
|
+
|
|
63
|
+
const oldMonth = date.getMonth();
|
|
64
|
+
date.setMonth(oldMonth + 1);
|
|
65
|
+
const newMonth = date.getMonth();
|
|
66
|
+
if (newMonth - oldMonth > 1) {
|
|
67
|
+
date.setMonth(newMonth - 1);
|
|
68
|
+
}
|
|
69
|
+
return this.getDateObj(date);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 获取指定格式Date对象
|
|
74
|
+
*/
|
|
75
|
+
getDateObj(date) {
|
|
76
|
+
date = fixIosDateFormat(date);
|
|
77
|
+
date = new Date(date);
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
fullDate: getDate(date),
|
|
81
|
+
year: date.getFullYear(),
|
|
82
|
+
month: addZero(date.getMonth() + 1),
|
|
83
|
+
date: addZero(date.getDate()),
|
|
84
|
+
day: date.getDay(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 获取上一个月日期集合
|
|
90
|
+
*/
|
|
91
|
+
getPreMonthDays(amount, dateObj) {
|
|
92
|
+
const result = [];
|
|
93
|
+
for (let i = amount - 1; i >= 0; i--) {
|
|
94
|
+
const month = dateObj.month - 1;
|
|
95
|
+
result.push({
|
|
96
|
+
date: new Date(dateObj.year, month, -i).getDate(),
|
|
97
|
+
month,
|
|
98
|
+
disable: true,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 获取本月日期集合
|
|
105
|
+
*/
|
|
106
|
+
getCurrentMonthDays(amount, dateObj) {
|
|
107
|
+
const result = [];
|
|
108
|
+
const fullDate = this.date.fullDate;
|
|
109
|
+
for (let i = 1; i <= amount; i++) {
|
|
110
|
+
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`;
|
|
111
|
+
const isToday = fullDate === currentDate;
|
|
112
|
+
// 获取打点信息
|
|
113
|
+
const info =
|
|
114
|
+
this.selected &&
|
|
115
|
+
this.selected.find((item) => {
|
|
116
|
+
if (this.dateEqual(currentDate, item.date)) {
|
|
117
|
+
return item;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// 日期禁用
|
|
122
|
+
let disableBefore = true;
|
|
123
|
+
let disableAfter = true;
|
|
124
|
+
if (this.startDate) {
|
|
125
|
+
disableBefore = dateCompare(this.startDate, currentDate);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (this.endDate) {
|
|
129
|
+
disableAfter = dateCompare(currentDate, this.endDate);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let multiples = this.multipleStatus.data;
|
|
133
|
+
let multiplesStatus = -1;
|
|
134
|
+
if (this.range && multiples) {
|
|
135
|
+
multiplesStatus = multiples.findIndex((item) => {
|
|
136
|
+
return this.dateEqual(item, currentDate);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const checked = multiplesStatus !== -1;
|
|
140
|
+
|
|
141
|
+
result.push({
|
|
142
|
+
fullDate: currentDate,
|
|
143
|
+
year: dateObj.year,
|
|
144
|
+
date: i,
|
|
145
|
+
multiple: this.range ? checked : false,
|
|
146
|
+
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
|
147
|
+
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
|
148
|
+
month: dateObj.month,
|
|
149
|
+
disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate, this.endDate)),
|
|
150
|
+
isToday,
|
|
151
|
+
userChecked: false,
|
|
152
|
+
extraInfo: info,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 获取下一个月日期集合
|
|
159
|
+
*/
|
|
160
|
+
_getNextMonthDays(amount, dateObj) {
|
|
161
|
+
const result = [];
|
|
162
|
+
const month = dateObj.month + 1;
|
|
163
|
+
for (let i = 1; i <= amount; i++) {
|
|
164
|
+
result.push({
|
|
165
|
+
date: i,
|
|
166
|
+
month,
|
|
167
|
+
disable: true,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 获取当前日期详情
|
|
175
|
+
* @param {Object} date
|
|
176
|
+
*/
|
|
177
|
+
getInfo(date) {
|
|
178
|
+
if (!date) {
|
|
179
|
+
date = new Date();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return this.calendar.find((item) => item.fullDate === this.getDateObj(date).fullDate);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 比较时间是否相等
|
|
187
|
+
*/
|
|
188
|
+
dateEqual(before, after) {
|
|
189
|
+
before = new Date(fixIosDateFormat(before));
|
|
190
|
+
after = new Date(fixIosDateFormat(after));
|
|
191
|
+
return before.valueOf() === after.valueOf();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* 比较真实起始日期
|
|
196
|
+
*/
|
|
197
|
+
|
|
198
|
+
isLogicBefore(currentDate, before, after) {
|
|
199
|
+
let logicBefore = before;
|
|
200
|
+
if (before && after) {
|
|
201
|
+
logicBefore = dateCompare(before, after) ? before : after;
|
|
202
|
+
}
|
|
203
|
+
return this.dateEqual(logicBefore, currentDate);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
isLogicAfter(currentDate, before, after) {
|
|
207
|
+
let logicAfter = after;
|
|
208
|
+
if (before && after) {
|
|
209
|
+
logicAfter = dateCompare(before, after) ? after : before;
|
|
210
|
+
}
|
|
211
|
+
return this.dateEqual(logicAfter, currentDate);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 获取日期范围内所有日期
|
|
216
|
+
* @param {Object} begin
|
|
217
|
+
* @param {Object} end
|
|
218
|
+
*/
|
|
219
|
+
geDateAll(begin, end) {
|
|
220
|
+
var arr = [];
|
|
221
|
+
var ab = begin.split('-');
|
|
222
|
+
var ae = end.split('-');
|
|
223
|
+
var db = new Date();
|
|
224
|
+
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
|
|
225
|
+
var de = new Date();
|
|
226
|
+
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
|
|
227
|
+
var unixDb = db.getTime() - 24 * 60 * 60 * 1000;
|
|
228
|
+
var unixDe = de.getTime() - 24 * 60 * 60 * 1000;
|
|
229
|
+
for (var k = unixDb; k <= unixDe; ) {
|
|
230
|
+
k = k + 24 * 60 * 60 * 1000;
|
|
231
|
+
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate);
|
|
232
|
+
}
|
|
233
|
+
return arr;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 获取多选状态
|
|
238
|
+
*/
|
|
239
|
+
setMultiple(fullDate) {
|
|
240
|
+
if (!this.range) return;
|
|
241
|
+
|
|
242
|
+
let { before, after } = this.multipleStatus;
|
|
243
|
+
if (before && after) {
|
|
244
|
+
if (!this.lastHover) {
|
|
245
|
+
this.lastHover = true;
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.multipleStatus.before = fullDate;
|
|
249
|
+
this.multipleStatus.after = '';
|
|
250
|
+
this.multipleStatus.data = [];
|
|
251
|
+
this.multipleStatus.fulldate = '';
|
|
252
|
+
this.lastHover = false;
|
|
253
|
+
} else {
|
|
254
|
+
if (!before) {
|
|
255
|
+
this.multipleStatus.before = fullDate;
|
|
256
|
+
this.lastHover = false;
|
|
257
|
+
} else {
|
|
258
|
+
this.multipleStatus.after = fullDate;
|
|
259
|
+
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
260
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
|
261
|
+
} else {
|
|
262
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
|
263
|
+
}
|
|
264
|
+
this.lastHover = true;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
this.getWeeks(fullDate);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* 鼠标 hover 更新多选状态
|
|
272
|
+
*/
|
|
273
|
+
setHoverMultiple(fullDate) {
|
|
274
|
+
if (!this.range || this.lastHover) return;
|
|
275
|
+
|
|
276
|
+
const { before } = this.multipleStatus;
|
|
277
|
+
|
|
278
|
+
if (!before) {
|
|
279
|
+
this.multipleStatus.before = fullDate;
|
|
280
|
+
} else {
|
|
281
|
+
this.multipleStatus.after = fullDate;
|
|
282
|
+
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
283
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
|
284
|
+
} else {
|
|
285
|
+
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
this.getWeeks(fullDate);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 更新默认值多选状态
|
|
293
|
+
*/
|
|
294
|
+
setDefaultMultiple(before, after) {
|
|
295
|
+
this.multipleStatus.before = before;
|
|
296
|
+
this.multipleStatus.after = after;
|
|
297
|
+
if (before && after) {
|
|
298
|
+
if (dateCompare(before, after)) {
|
|
299
|
+
this.multipleStatus.data = this.geDateAll(before, after);
|
|
300
|
+
this.getWeeks(after);
|
|
301
|
+
} else {
|
|
302
|
+
this.multipleStatus.data = this.geDateAll(after, before);
|
|
303
|
+
this.getWeeks(before);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* 获取每周数据
|
|
310
|
+
* @param {Object} dateData
|
|
311
|
+
*/
|
|
312
|
+
getWeeks(dateData) {
|
|
313
|
+
const { year, month } = this.getDateObj(dateData);
|
|
314
|
+
|
|
315
|
+
const preMonthDayAmount = new Date(year, month - 1, 1).getDay();
|
|
316
|
+
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData));
|
|
317
|
+
|
|
318
|
+
const currentMonthDayAmount = new Date(year, month, 0).getDate();
|
|
319
|
+
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData));
|
|
320
|
+
|
|
321
|
+
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount;
|
|
322
|
+
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData));
|
|
323
|
+
|
|
324
|
+
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays];
|
|
325
|
+
|
|
326
|
+
const weeks = new Array(6);
|
|
327
|
+
for (let i = 0; i < calendarDays.length; i++) {
|
|
328
|
+
const index = Math.floor(i / 7);
|
|
329
|
+
if (!weeks[index]) {
|
|
330
|
+
weeks[index] = new Array(7);
|
|
331
|
+
}
|
|
332
|
+
weeks[index][i % 7] = calendarDays[i];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
this.calendar = calendarDays;
|
|
336
|
+
this.weeks = weeks;
|
|
73
337
|
}
|
|
74
|
-
return this.getDateObj(date)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* 获取指定格式Date对象
|
|
79
|
-
*/
|
|
80
|
-
getDateObj(date) {
|
|
81
|
-
date = fixIosDateFormat(date)
|
|
82
|
-
date = new Date(date)
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
fullDate: getDate(date),
|
|
86
|
-
year: date.getFullYear(),
|
|
87
|
-
month: addZero(date.getMonth() + 1),
|
|
88
|
-
date: addZero(date.getDate()),
|
|
89
|
-
day: date.getDay()
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* 获取上一个月日期集合
|
|
95
|
-
*/
|
|
96
|
-
getPreMonthDays(amount, dateObj) {
|
|
97
|
-
const result = []
|
|
98
|
-
for (let i = amount - 1; i >= 0; i--) {
|
|
99
|
-
const month = dateObj.month - 1
|
|
100
|
-
result.push({
|
|
101
|
-
date: new Date(dateObj.year, month, -i).getDate(),
|
|
102
|
-
month,
|
|
103
|
-
disable: true
|
|
104
|
-
})
|
|
105
|
-
}
|
|
106
|
-
return result
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* 获取本月日期集合
|
|
110
|
-
*/
|
|
111
|
-
getCurrentMonthDays(amount, dateObj) {
|
|
112
|
-
const result = []
|
|
113
|
-
const fullDate = this.date.fullDate
|
|
114
|
-
for (let i = 1; i <= amount; i++) {
|
|
115
|
-
const currentDate = `${dateObj.year}-${dateObj.month}-${addZero(i)}`
|
|
116
|
-
const isToday = fullDate === currentDate
|
|
117
|
-
// 获取打点信息
|
|
118
|
-
const info = this.selected && this.selected.find((item) => {
|
|
119
|
-
if (this.dateEqual(currentDate, item.date)) {
|
|
120
|
-
return item
|
|
121
|
-
}
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
// 日期禁用
|
|
125
|
-
let disableBefore = true
|
|
126
|
-
let disableAfter = true
|
|
127
|
-
if (this.startDate) {
|
|
128
|
-
disableBefore = dateCompare(this.startDate, currentDate)
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (this.endDate) {
|
|
132
|
-
disableAfter = dateCompare(currentDate, this.endDate)
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
let multiples = this.multipleStatus.data
|
|
136
|
-
let multiplesStatus = -1
|
|
137
|
-
if (this.range && multiples) {
|
|
138
|
-
multiplesStatus = multiples.findIndex((item) => {
|
|
139
|
-
return this.dateEqual(item, currentDate)
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
const checked = multiplesStatus !== -1
|
|
143
|
-
|
|
144
|
-
result.push({
|
|
145
|
-
fullDate: currentDate,
|
|
146
|
-
year: dateObj.year,
|
|
147
|
-
date: i,
|
|
148
|
-
multiple: this.range ? checked : false,
|
|
149
|
-
beforeMultiple: this.isLogicBefore(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
|
150
|
-
afterMultiple: this.isLogicAfter(currentDate, this.multipleStatus.before, this.multipleStatus.after),
|
|
151
|
-
month: dateObj.month,
|
|
152
|
-
disable: (this.startDate && !dateCompare(this.startDate, currentDate)) || (this.endDate && !dateCompare(currentDate,this.endDate)),
|
|
153
|
-
isToday,
|
|
154
|
-
userChecked: false,
|
|
155
|
-
extraInfo: info
|
|
156
|
-
})
|
|
157
|
-
}
|
|
158
|
-
return result
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* 获取下一个月日期集合
|
|
162
|
-
*/
|
|
163
|
-
_getNextMonthDays(amount, dateObj) {
|
|
164
|
-
const result = []
|
|
165
|
-
const month = dateObj.month + 1
|
|
166
|
-
for (let i = 1; i <= amount; i++) {
|
|
167
|
-
result.push({
|
|
168
|
-
date: i,
|
|
169
|
-
month,
|
|
170
|
-
disable: true
|
|
171
|
-
})
|
|
172
|
-
}
|
|
173
|
-
return result
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* 获取当前日期详情
|
|
178
|
-
* @param {Object} date
|
|
179
|
-
*/
|
|
180
|
-
getInfo(date) {
|
|
181
|
-
if (!date) {
|
|
182
|
-
date = new Date()
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return this.calendar.find(item => item.fullDate === this.getDateObj(date).fullDate)
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 比较时间是否相等
|
|
190
|
-
*/
|
|
191
|
-
dateEqual(before, after) {
|
|
192
|
-
before = new Date(fixIosDateFormat(before))
|
|
193
|
-
after = new Date(fixIosDateFormat(after))
|
|
194
|
-
return before.valueOf() === after.valueOf()
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* 比较真实起始日期
|
|
199
|
-
*/
|
|
200
|
-
|
|
201
|
-
isLogicBefore(currentDate, before, after) {
|
|
202
|
-
let logicBefore = before
|
|
203
|
-
if (before && after) {
|
|
204
|
-
logicBefore = dateCompare(before, after) ? before : after
|
|
205
|
-
}
|
|
206
|
-
return this.dateEqual(logicBefore, currentDate)
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
isLogicAfter(currentDate, before, after) {
|
|
210
|
-
let logicAfter = after
|
|
211
|
-
if (before && after) {
|
|
212
|
-
logicAfter = dateCompare(before, after) ? after : before
|
|
213
|
-
}
|
|
214
|
-
return this.dateEqual(logicAfter, currentDate)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* 获取日期范围内所有日期
|
|
219
|
-
* @param {Object} begin
|
|
220
|
-
* @param {Object} end
|
|
221
|
-
*/
|
|
222
|
-
geDateAll(begin, end) {
|
|
223
|
-
var arr = []
|
|
224
|
-
var ab = begin.split('-')
|
|
225
|
-
var ae = end.split('-')
|
|
226
|
-
var db = new Date()
|
|
227
|
-
db.setFullYear(ab[0], ab[1] - 1, ab[2])
|
|
228
|
-
var de = new Date()
|
|
229
|
-
de.setFullYear(ae[0], ae[1] - 1, ae[2])
|
|
230
|
-
var unixDb = db.getTime() - 24 * 60 * 60 * 1000
|
|
231
|
-
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
|
|
232
|
-
for (var k = unixDb; k <= unixDe;) {
|
|
233
|
-
k = k + 24 * 60 * 60 * 1000
|
|
234
|
-
arr.push(this.getDateObj(new Date(parseInt(k))).fullDate)
|
|
235
|
-
}
|
|
236
|
-
return arr
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* 获取多选状态
|
|
241
|
-
*/
|
|
242
|
-
setMultiple(fullDate) {
|
|
243
|
-
if (!this.range) return
|
|
244
|
-
|
|
245
|
-
let {
|
|
246
|
-
before,
|
|
247
|
-
after
|
|
248
|
-
} = this.multipleStatus
|
|
249
|
-
if (before && after) {
|
|
250
|
-
if (!this.lastHover) {
|
|
251
|
-
this.lastHover = true
|
|
252
|
-
return
|
|
253
|
-
}
|
|
254
|
-
this.multipleStatus.before = fullDate
|
|
255
|
-
this.multipleStatus.after = ''
|
|
256
|
-
this.multipleStatus.data = []
|
|
257
|
-
this.multipleStatus.fulldate = ''
|
|
258
|
-
this.lastHover = false
|
|
259
|
-
} else {
|
|
260
|
-
if (!before) {
|
|
261
|
-
this.multipleStatus.before = fullDate
|
|
262
|
-
this.lastHover = false
|
|
263
|
-
} else {
|
|
264
|
-
this.multipleStatus.after = fullDate
|
|
265
|
-
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
266
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus
|
|
267
|
-
.after);
|
|
268
|
-
} else {
|
|
269
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus
|
|
270
|
-
.before);
|
|
271
|
-
}
|
|
272
|
-
this.lastHover = true
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
this.getWeeks(fullDate)
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* 鼠标 hover 更新多选状态
|
|
280
|
-
*/
|
|
281
|
-
setHoverMultiple(fullDate) {
|
|
282
|
-
if (!this.range || this.lastHover) return
|
|
283
|
-
|
|
284
|
-
const { before } = this.multipleStatus
|
|
285
|
-
|
|
286
|
-
if (!before) {
|
|
287
|
-
this.multipleStatus.before = fullDate
|
|
288
|
-
} else {
|
|
289
|
-
this.multipleStatus.after = fullDate
|
|
290
|
-
if (dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
|
|
291
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
|
|
292
|
-
} else {
|
|
293
|
-
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
this.getWeeks(fullDate)
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* 更新默认值多选状态
|
|
301
|
-
*/
|
|
302
|
-
setDefaultMultiple(before, after) {
|
|
303
|
-
this.multipleStatus.before = before
|
|
304
|
-
this.multipleStatus.after = after
|
|
305
|
-
if (before && after) {
|
|
306
|
-
if (dateCompare(before, after)) {
|
|
307
|
-
this.multipleStatus.data = this.geDateAll(before, after);
|
|
308
|
-
this.getWeeks(after)
|
|
309
|
-
} else {
|
|
310
|
-
this.multipleStatus.data = this.geDateAll(after, before);
|
|
311
|
-
this.getWeeks(before)
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/**
|
|
317
|
-
* 获取每周数据
|
|
318
|
-
* @param {Object} dateData
|
|
319
|
-
*/
|
|
320
|
-
getWeeks(dateData) {
|
|
321
|
-
const {
|
|
322
|
-
year,
|
|
323
|
-
month,
|
|
324
|
-
} = this.getDateObj(dateData)
|
|
325
|
-
|
|
326
|
-
const preMonthDayAmount = new Date(year, month - 1, 1).getDay()
|
|
327
|
-
const preMonthDays = this.getPreMonthDays(preMonthDayAmount, this.getDateObj(dateData))
|
|
328
|
-
|
|
329
|
-
const currentMonthDayAmount = new Date(year, month, 0).getDate()
|
|
330
|
-
const currentMonthDays = this.getCurrentMonthDays(currentMonthDayAmount, this.getDateObj(dateData))
|
|
331
|
-
|
|
332
|
-
const nextMonthDayAmount = 42 - preMonthDayAmount - currentMonthDayAmount
|
|
333
|
-
const nextMonthDays = this._getNextMonthDays(nextMonthDayAmount, this.getDateObj(dateData))
|
|
334
|
-
|
|
335
|
-
const calendarDays = [...preMonthDays, ...currentMonthDays, ...nextMonthDays]
|
|
336
|
-
|
|
337
|
-
const weeks = new Array(6)
|
|
338
|
-
for (let i = 0; i < calendarDays.length; i++) {
|
|
339
|
-
const index = Math.floor(i / 7)
|
|
340
|
-
if(!weeks[index]){
|
|
341
|
-
weeks[index] = new Array(7)
|
|
342
|
-
}
|
|
343
|
-
weeks[index][i % 7] = calendarDays[i]
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
this.calendar = calendarDays
|
|
347
|
-
this.weeks = weeks
|
|
348
|
-
}
|
|
349
338
|
}
|
|
350
339
|
|
|
351
|
-
function getDateTime(date, hideSecond){
|
|
352
|
-
|
|
340
|
+
function getDateTime(date, hideSecond) {
|
|
341
|
+
return `${getDate(date)} ${getTime(date, hideSecond)}`;
|
|
353
342
|
}
|
|
354
343
|
|
|
355
344
|
function getDate(date) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
345
|
+
date = fixIosDateFormat(date);
|
|
346
|
+
date = new Date(date);
|
|
347
|
+
const year = date.getFullYear();
|
|
348
|
+
const month = date.getMonth() + 1;
|
|
349
|
+
const day = date.getDate();
|
|
350
|
+
return `${year}-${addZero(month)}-${addZero(day)}`;
|
|
362
351
|
}
|
|
363
352
|
|
|
364
|
-
function getTime(date, hideSecond){
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
353
|
+
function getTime(date, hideSecond) {
|
|
354
|
+
date = fixIosDateFormat(date);
|
|
355
|
+
date = new Date(date);
|
|
356
|
+
const hour = date.getHours();
|
|
357
|
+
const minute = date.getMinutes();
|
|
358
|
+
const second = date.getSeconds();
|
|
359
|
+
return hideSecond ? `${addZero(hour)}:${addZero(minute)}` : `${addZero(hour)}:${addZero(minute)}:${addZero(second)}`;
|
|
371
360
|
}
|
|
372
361
|
|
|
373
362
|
function addZero(num) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
363
|
+
if (num < 10) {
|
|
364
|
+
num = `0${num}`;
|
|
365
|
+
}
|
|
366
|
+
return num;
|
|
378
367
|
}
|
|
379
368
|
|
|
380
369
|
function getDefaultSecond(hideSecond) {
|
|
381
|
-
|
|
370
|
+
return hideSecond ? '00:00' : '00:00:00';
|
|
382
371
|
}
|
|
383
372
|
|
|
384
373
|
function dateCompare(startDate, endDate) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
374
|
+
startDate = new Date(fixIosDateFormat(startDate));
|
|
375
|
+
endDate = new Date(fixIosDateFormat(endDate));
|
|
376
|
+
return startDate <= endDate;
|
|
388
377
|
}
|
|
389
378
|
|
|
390
|
-
function checkDate(date){
|
|
391
|
-
|
|
392
|
-
|
|
379
|
+
function checkDate(date) {
|
|
380
|
+
const dateReg = /((19|20)\d{2})(-|\/)\d{1,2}(-|\/)\d{1,2}/g;
|
|
381
|
+
return date.match(dateReg);
|
|
393
382
|
}
|
|
394
383
|
|
|
395
|
-
const dateTimeReg = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])( [0-5][0-9]:[0-5][0-9]:[0-5][0-9])
|
|
384
|
+
const dateTimeReg = /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])( [0-5][0-9]:[0-5][0-9]:[0-5][0-9])?$/;
|
|
396
385
|
function fixIosDateFormat(value) {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
386
|
+
if (typeof value === 'string' && dateTimeReg.test(value)) {
|
|
387
|
+
value = value.replace(/-/g, '/');
|
|
388
|
+
}
|
|
389
|
+
return value;
|
|
401
390
|
}
|
|
402
391
|
|
|
403
|
-
export {Calendar, getDateTime, getDate, getTime, addZero, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat}
|
|
392
|
+
export { Calendar, getDateTime, getDate, getTime, addZero, getDefaultSecond, dateCompare, checkDate, fixIosDateFormat };
|