u
This commit is contained in:
1 parent
33113f279c
commit
c2c5cc92af
16 files changed
+864
-352
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
/**
|
||||
* 获取当前日期,默认格式: YYYY-MM-DD
|
||||
*/
|
||||
export function getCurrentDate(format = 'YYYY-MM-DD'): string {
|
||||
return dayjs().format(format)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前日期时间,默认格式: YYYY-MM-DD HH:mm:ss
|
||||
*/
|
||||
export function getCurrentDateTime(format = 'YYYY-MM-DD HH:mm:ss'): string {
|
||||
return dayjs().format(format)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间,默认格式: HH:mm:ss
|
||||
*/
|
||||
export function getCurrentTime(format = 'HH:mm:ss'): string {
|
||||
return dayjs().format(format)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前年月,默认格式: YYYY-MM
|
||||
*/
|
||||
export function getCurrentYearMonth(format = 'YYYY-MM'): string {
|
||||
return dayjs().format(format)
|
||||
}
|
||||
Reference in new issue
Block a user