feat: 本次提交更新内容如下
场景获客列表搞定
This commit is contained in:
@@ -5,3 +5,25 @@ export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function formatDate(date: Date | string, format = "yyyy-MM-dd"): string {
|
||||
const d = typeof date === "string" ? new Date(date) : date
|
||||
|
||||
if (isNaN(d.getTime())) {
|
||||
return "Invalid Date"
|
||||
}
|
||||
|
||||
const year = d.getFullYear()
|
||||
const month = String(d.getMonth() + 1).padStart(2, "0")
|
||||
const day = String(d.getDate()).padStart(2, "0")
|
||||
const hours = String(d.getHours()).padStart(2, "0")
|
||||
const minutes = String(d.getMinutes()).padStart(2, "0")
|
||||
const seconds = String(d.getSeconds()).padStart(2, "0")
|
||||
|
||||
return format
|
||||
.replace("yyyy", String(year))
|
||||
.replace("MM", month)
|
||||
.replace("dd", day)
|
||||
.replace("HH", hours)
|
||||
.replace("mm", minutes)
|
||||
.replace("ss", seconds)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user