时间格式化
This commit is contained in:
parent
2e3c457952
commit
7cbd2bfe98
|
|
@ -86,7 +86,7 @@ export function selectDictLabel(datas, value) {
|
||||||
|
|
||||||
// 回显数据字典(字符串、数组)
|
// 回显数据字典(字符串、数组)
|
||||||
export function selectDictLabels(datas, value, separator) {
|
export function selectDictLabels(datas, value, separator) {
|
||||||
if (value === undefined || value.length ===0) {
|
if (value === undefined || value.length === 0) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if (Array.isArray(value)) {
|
if (Array.isArray(value)) {
|
||||||
|
|
@ -230,9 +230,10 @@ export function blobValidate(data) {
|
||||||
// 将年月日格式转换为yyyy-MM-dd格式
|
// 将年月日格式转换为yyyy-MM-dd格式
|
||||||
export function formatDate(dateStr) {
|
export function formatDate(dateStr) {
|
||||||
if (!dateStr) return '';
|
if (!dateStr) return '';
|
||||||
|
const cleanedStr = dateStr.replace(/\s/g, '');
|
||||||
// 提取年、月、日
|
// 提取年、月、日
|
||||||
const match = dateStr.match(/(\d{4})年(\d{1,2})月(\d{1,2})日/);
|
const match = cleanedStr.match(/(\d{4})年(\d{1,2})月(\d{1,2})日/);
|
||||||
if (!match) return dateStr;
|
if (!match) return cleanedStr;
|
||||||
const year = match[1];
|
const year = match[1];
|
||||||
const month = match[2].padStart(2, '0'); // 月份补零
|
const month = match[2].padStart(2, '0'); // 月份补零
|
||||||
const day = match[3].padStart(2, '0'); // 日期补零
|
const day = match[3].padStart(2, '0'); // 日期补零
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue