-
Notifications
You must be signed in to change notification settings - Fork 363
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(DatePicker): fix boundary week format bug (#3336)
* docs: fix datepicker week firstdayofweek usage demo * fix(DatePicker): fix week calculate bug
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
Submodule _common
updated
60 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
<template> | ||
<t-space direction="vertical"> | ||
<t-date-picker mode="week" clearable allow-input /> | ||
<t-date-range-picker mode="week" clearable allow-input /> | ||
<t-date-picker mode="week" clearable allow-input :first-day-of-week="weekStart" /> | ||
|
||
<t-date-range-picker mode="week" clearable allow-input :first-day-of-week="weekStart" /> | ||
</t-space> | ||
</template> | ||
<script setup> | ||
// 如果配合 firstDayOfWeek API 使用,请使用 dayjs 同步修改 weekStart,否则部分日期选择会用异常 | ||
import { ref } from 'vue'; | ||
import dayjs from 'dayjs'; | ||
import updateLocale from 'dayjs/plugin/updateLocale'; | ||
dayjs.extend(updateLocale); | ||
dayjs.updateLocale('zh-cn', { | ||
weekStart: 2, | ||
}); | ||
const weekStart = ref(2); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,26 @@ | ||
<template> | ||
<t-space direction="vertical"> | ||
<t-date-picker mode="week" clearable allow-input /> | ||
<t-date-range-picker mode="week" clearable allow-input /> | ||
<t-date-picker mode="week" clearable allow-input :first-day-of-week="weekStart" /> | ||
|
||
<t-date-range-picker mode="week" clearable allow-input :first-day-of-week="weekStart" /> | ||
</t-space> | ||
</template> | ||
<script> | ||
// 如果配合 firstDayOfWeek API 使用,请使用 dayjs 同步修改 weekStart,否则部分日期选择会用异常 | ||
import dayjs from 'dayjs'; | ||
import updateLocale from 'dayjs/plugin/updateLocale'; | ||
dayjs.extend(updateLocale); | ||
dayjs.updateLocale('zh-cn', { | ||
weekStart: 2, | ||
}); | ||
export default { | ||
data() { | ||
return { | ||
weekStart: 2, | ||
}; | ||
}, | ||
}; | ||
</script> |