web-base-admin/src/utils/date.js

16 lines
365 B
JavaScript

import dayjs from 'dayjs'
export function getBeforeDays(n = 1) {
return dayjs().subtract(n, 'day').format('YYYY-MM-DD')
}
// 获取本月第一天
export function getMonthFirstDay() {
return dayjs().startOf('month').format('YYYY-MM-DD')
}
// 获取本月最后一天
export function getMonthLastDay() {
return dayjs().endOf('month').format('YYYY-MM-DD')
}