@pmun/utils / commonDateShortcuts
Variable: commonDateShortcuts
ts
const commonDateShortcuts: DateShortcutsConfig;常用日期范围快捷键配置
可直接用于 DateRangePicker 组件的 shortcuts 属性
Example
ts
// 在 Element Plus 中使用
<el-date-picker
type="daterange"
:shortcuts="Object.entries(commonDateShortcuts).map(([text, value]) => ({ text, value }))"
/>
// 获取今天的范围
const [start, end] = commonDateShortcuts['今天']()
// 获取本月的范围
const [start, end] = commonDateShortcuts['本月']()