UNPKG

sard-uniapp

Version:

sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库

26 lines (25 loc) 812 B
import { defaultConfig } from '../config'; export const defaultCalendarProps = () => ({ type: 'single', maxDays: Number.MAX_SAFE_INTEGER, weekStartsOn: 0, ...defaultConfig.calendar, }); export const getMinDate = (severalMonths) => { const date = new Date(); if (severalMonths) { return new Date(date.getFullYear(), date.getMonth(), 1); } return new Date(date.getFullYear() - 10, 0, 1); }; export const getMaxDate = (severalMonths) => { const date = new Date(); if (severalMonths) { return new Date(date.getFullYear(), date.getMonth() + 3, 0); } return new Date(date.getFullYear() + 10, 11, 31); }; export const sortDates = (dates) => { return dates.sort((a, b) => a.getTime() - b.getTime()); }; export const weeksIndex = [0, 1, 2, 3, 4, 5, 6];