Merge branch 'dev' of codeup.aliyun.com:61c14a7efa282c88e103c23f/oak-domain into dev
This commit is contained in:
commit
bbce3c5f4b
|
|
@ -0,0 +1 @@
|
|||
export declare function excelStringToDate(str: string | number): number | undefined;
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.excelStringToDate = void 0;
|
||||
var tslib_1 = require("tslib");
|
||||
var dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
||||
function excelStringToDate(str) {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof str === 'number') {
|
||||
if (str < 100000) {
|
||||
return (0, dayjs_1.default)((((str - 25569) * 24 - 8) * 3600) * 1000).valueOf(); // excel日期可能为1900-1-1至今的天数
|
||||
}
|
||||
return (0, dayjs_1.default)(str).valueOf();
|
||||
}
|
||||
return Date.parse(str);
|
||||
}
|
||||
exports.excelStringToDate = excelStringToDate;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
import dayjs from 'dayjs';
|
||||
|
||||
export function excelStringToDate(str: string | number) {
|
||||
if (!str) {
|
||||
return undefined;
|
||||
}
|
||||
if (typeof str === 'number') {
|
||||
if (str < 100000) {
|
||||
return dayjs((((str - 25569) * 24 - 8) * 3600) * 1000).valueOf(); // excel日期可能为1900-1-1至今的天数
|
||||
}
|
||||
return dayjs(str).valueOf();
|
||||
}
|
||||
return Date.parse(str);
|
||||
}
|
||||
Loading…
Reference in New Issue