修复DateExt时间格式化转化错误问题

This commit is contained in:
dgflash
2025-10-16 11:25:18 +08:00
parent cb58314d4d
commit 03211d8a93
2 changed files with 2 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ Date.prototype.format = function (format: string): string {
let r = format
.replace('yy', year.toString())
.replace('mm', (month < 10 ? '0' : '') + month)
.replace('MM', (month < 10 ? '0' : '') + month)
.replace('dd', (day < 10 ? '0' : '') + day)
.replace('hh', (hours < 10 ? '0' : '') + hours)
.replace('mm', (minutes < 10 ? '0' : '') + minutes)

View File

@@ -9,7 +9,7 @@ class StringFormat {
if (format === '') return value as string;
format = format.toLowerCase().trim(); // 不区分大小
let match_func = format.match(/^[a-z|A-Z]+/gi); // 匹配到 format 中的 函数名
let match_func = format.match(/^[a-z|A-Z]+/gi); // 匹配到 format 中的函数名
let match_num = format.match(/\d+$/gi); // 匹配到 format 中的参数
let func: string = '';
let num: number = 0;