Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
chore(lint): fix numfmt type (#3206)
Gpound.liuc67fc66ab43a
diff --git a/packages/sheets-data-validation/src/validators/date-validator.ts b/packages/sheets-data-validation/src/validators/date-validator.tsindex 2466553b10..a32ba23ad9 100644--- a/packages/sheets-data-validation/src/validators/date-validator.ts+++ b/packages/sheets-data-validation/src/validators/date-validator.ts@@ -41,7 +41,7 @@ const transformDate2SerialNumber = (value: Nullable<CellValue>) => {// transform date string to serial numberconst dateStr = `${dayjs(value).format('YYYY-MM-DD HH:mm:ss')}`;- return numfmt.parseDate(dateStr)?.v;+ return numfmt.parseDate(dateStr)?.v as number | undefined;};export class DateValidator extends BaseDataValidator<number> {diff --git a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx b/packages/sheets-data-validation/src/views/date-dropdown/index.tsxindex 81ee0ff14f..5cd69e019e 100644--- a/packages/sheets-data-validation/src/views/date-dropdown/index.tsx+++ b/packages/sheets-data-validation/src/views/date-dropdown/index.tsx@@ -35,7 +35,7 @@ const transformDate = (value: Nullable<CellValue>) => {}if (typeof value === 'number' || !Number.isNaN(+value)) {- return dayjs(numfmt.format('yyyy-MM-dd HH:mm:ss', value));+ return dayjs(numfmt.format('yyyy-MM-dd HH:mm:ss', Number(value)));}const date = dayjs(value);@@ -70,7 +70,7 @@ export function DateDropdown(props: IDropdownComponentProps) {const newValue = date;// convert current date to utc dateconst dateStr = newValue.format(showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD 00:00:00');- const serialTime = numfmt.parseDate(dateStr)?.v;+ const serialTime = numfmt.parseDate(dateStr)?.v as number;if (rule.errorStyle !== DataValidationErrorStyle.STOP ||