Update from Vibe Studio

This commit is contained in:
Vibe Studio
2026-01-09 14:52:46 +00:00
parent 42a0efe70b
commit 47fa6d98b2
28661 changed files with 2421771 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
import dayjs from 'dayjs';
type DateValue = dayjs.Dayjs | dayjs.Dayjs[] | string | string[] | number | number[];
export declare const parseValueToDay: (value: DateValue, formatter?: string) => dayjs.Dayjs | dayjs.Dayjs[] | null | undefined;
export {};

View File

@@ -0,0 +1,27 @@
import dayjs from 'dayjs';
import customParseFormat from 'dayjs/plugin/customParseFormat';
import { isNil } from "../isNil";
dayjs.extend(customParseFormat);
/**
* 一个比较hack的moment判断工具
* @param value
* @returns
*/
var isMoment = function isMoment(value) {
return !!(value !== null && value !== void 0 && value._isAMomentObject);
};
export var parseValueToDay = function parseValueToDay(value, formatter) {
if (isNil(value) || dayjs.isDayjs(value) || isMoment(value)) {
if (isMoment(value)) {
return dayjs(value);
}
return value;
}
if (Array.isArray(value)) {
return value.map(function (v) {
return parseValueToDay(v, formatter);
});
}
if (typeof value === 'number') return dayjs(value);
return dayjs(value, formatter);
};