Skip to content

Commit 5fa2c18

Browse files
author
shenzhiqing
committed
fix(DatePicker): 修复时间精度自动改变的问题
1 parent 9275dd0 commit 5fa2c18

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

packages/core/src/DatePicker/pure-function.ts

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,26 +197,31 @@ export function getPickerData(timerDiff: TimerDiff, type: DateKey): ResultDate {
197197
export function minData(key: DateKey, changeParams: ChangeParams, precision: DateKey): ResultDate {
198198
const { MINTIMER = {}, nextLabel = {} } = changeParams;
199199
const newObj: ResultDate = {};
200-
if (key === 'second') return newObj;
201-
if (MINTIMER.second !== '00') {
202-
newObj.second = getMinutesOrSeconds();
200+
if (key === 'month') {
201+
return newObj;
203202
}
204-
if (key === 'minute') return newObj;
205-
if (MINTIMER.minute !== '00') {
206-
newObj.minute = getMinutesOrSeconds();
203+
if (MINTIMER.month !== '01') {
204+
newObj.month = getMonths();
205+
}
206+
if (key === 'day') {
207+
return newObj;
208+
}
209+
if (MINTIMER.day !== '01' || Number(nextLabel.month) !== 2) {
210+
newObj.day = getDays(Number(nextLabel.year), Number(nextLabel.month));
207211
}
208212
if (key === 'hour') return newObj;
209213
if (MINTIMER.hour !== '00') {
210214
newObj.hour = getHours();
211215
}
212-
if (key === 'day') return newObj;
213-
if (MINTIMER.day !== '01' || Number(nextLabel.month) !== 2) {
214-
newObj.day = getDays(Number(nextLabel.year), Number(nextLabel.month));
216+
if (key === 'minute') return newObj;
217+
if (MINTIMER.minute !== '00') {
218+
newObj.minute = getMinutesOrSeconds();
215219
}
216-
if (key === 'month') return newObj;
217-
if (MINTIMER.month !== '01') {
218-
newObj.month = getMonths();
220+
if (key === 'second') return newObj;
221+
if (MINTIMER.second !== '00') {
222+
newObj.second = getMinutesOrSeconds();
219223
}
224+
220225
return newObj;
221226
}
222227
/** 最大时间改变的 */

0 commit comments

Comments
 (0)