mirror of
https://github.com/MadeBaruna/paimon-moe.git
synced 2025-03-13 11:18:28 +01:00
Add check on excel import date type
This commit is contained in:
parent
e476be5e41
commit
d982c3d33f
1 changed files with 11 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
<script>
|
||||
import { t } from 'svelte-i18n';
|
||||
import { Workbook } from 'exceljs';
|
||||
import { Workbook, ValueType } from 'exceljs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import Button from '../../components/Button.svelte';
|
||||
|
@ -203,8 +203,17 @@
|
|||
sheet.eachRow((row, index) => {
|
||||
if (index === 1) return;
|
||||
const type = row.getCell(1).text.toLowerCase();
|
||||
const time = row.getCell(3).text;
|
||||
let time = row.getCell(3);
|
||||
const fullName = row.getCell(2).text;
|
||||
|
||||
if (time.type === ValueType.Date) {
|
||||
time = dayjs.utc(time.value).format('YYYY-MM-DD HH:mm:ss');
|
||||
} else {
|
||||
time = time.text;
|
||||
}
|
||||
|
||||
console.log(time);
|
||||
|
||||
let name = '';
|
||||
if (type === 'weapon') {
|
||||
name = weapons.find((e) => e.name === fullName).id;
|
||||
|
|
Loading…
Add table
Reference in a new issue