Skip to content

Commit 907ea34

Browse files
committed
Merge branch 'develop'
2 parents e1a37a5 + f296b7e commit 907ea34

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@silevis/reactgrid",
33
"description": "Add spreadsheet-like behavior to your React app.",
4-
"version": "4.1.13",
4+
"version": "4.1.14",
55
"homepage": "https://reactgrid.com",
66
"license": "MIT",
77
"author": "Silevis Software",
@@ -91,4 +91,4 @@
9191
"sass": "^1.62.1",
9292
"tslib": "^2.5.2"
9393
}
94-
}
94+
}

src/lib/Components/RowRenderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const MappedColumns: React.FC<RowRendererProps> = ({ columns, row, cellRenderer,
3939
borders={{
4040
...borders,
4141
left: borders.left && column.left === 0,
42-
right: (borders.right && column.idx === lastColIdx) || !(state.cellMatrix.scrollableRange.last.column.idx === location.column.idx)
42+
right: (borders.right && column.idx === lastColIdx) || !(state.cellMatrix.scrollableRange.last.column?.idx === location.column.idx)
4343
}}
4444
state={state}
4545
location={location}

src/lib/Functions/handlePaste.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,16 @@ export function handlePaste(event: ClipboardEvent, state: State): State {
4141
.getData("text/plain")
4242
.replace(/(\r\n)$/, '')
4343
.split("\n")
44-
.map((line: string) => line.split("\t").map((t) => ({ type: "text", text: t, value: parseLocaleNumber(t) })));
44+
.map((line: string) => line.split("\t").map((t) => {
45+
const parsedDate = parseExcelDate(t);
46+
return parsedDate ? { type: "date", text: t, value: parsedDate.getTime() } : { type: "text", text: t, value: parseLocaleNumber(t) };
47+
}));
4548
}
4649
event.preventDefault();
4750
return { ...pasteData(state, pastedRows) };
4851
}
49-
52+
53+
function parseExcelDate(excelDate: string): Date | null {
54+
const timestamp = Date.parse(excelDate);
55+
return isNaN(timestamp) ? null : new Date(timestamp);
56+
}

0 commit comments

Comments
 (0)