Files
dify/web/utils/time.ts
Maries a1b735a4c0 feat: trigger billing (#28335)
Signed-off-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: lyzno1 <yuanyouhuilyz@gmail.com>
Co-authored-by: lyzno1 <92089059+lyzno1@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-20 10:15:23 +08:00

20 lines
613 B
TypeScript

import dayjs, { type ConfigType } from 'dayjs'
import utc from 'dayjs/plugin/utc'
dayjs.extend(utc)
export const isAfter = (date: ConfigType, compare: ConfigType) => {
return dayjs(date).isAfter(dayjs(compare))
}
export const formatTime = ({ date, dateFormat }: { date: ConfigType; dateFormat: string }) => {
return dayjs(date).format(dateFormat)
}
export const getDaysUntilEndOfMonth = (date: ConfigType = dayjs()) => {
const current = dayjs(date).startOf('day')
const endOfMonth = dayjs(date).endOf('month').startOf('day')
const diff = endOfMonth.diff(current, 'day')
return Math.max(diff, 0)
}