sard-uniapp
Version:
sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库
21 lines (20 loc) • 590 B
JavaScript
import { defaultConfig } from '../config';
export const defaultDateStripProps = () => ({
type: 'single',
maxDays: Number.MAX_SAFE_INTEGER,
showLunar: false,
...defaultConfig.dateStrip,
});
export const getMinDate = (date = new Date()) => {
const start = new Date(date);
start.setDate(start.getDate() - 7);
return start;
};
export const getMaxDate = (date = new Date()) => {
const end = new Date(date);
end.setDate(end.getDate() + 7);
return end;
};
export const sortDates = (dates) => {
return dates.sort((a, b) => a.getTime() - b.getTime());
};