Skip to content

Commit 2e9ca99

Browse files
author
Caleb Rogers
committed
Merge pull request 'fix-pathname-ts-warning' (#7) from sultanmyrza/running-calorie-average:fix-pathname-ts-warning into main
Reviewed-on: https://codeberg.org/508_dev/running-calorie-average/pulls/7 Reviewed-by: Caleb Rogers <[email protected]>
2 parents afffdd0 + f87f4d7 commit 2e9ca99

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/routes/+page.svelte

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
2121
let pathname = '';
2222
23-
page.subscribe(($page) => (pathname = $page.url.searchParams.get('date')));
23+
page.subscribe(($page) => {
24+
const date = $page.url.searchParams.get('date');
25+
pathname = date ?? new Date().toDateString();
26+
});
2427
2528
// If the date query param is somehow invalid, try to set it to today
2629
if (!pathname || typeof pathname !== 'string' || isNaN(new Date(pathname).valueOf())) {

tsconfig.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": "./.svelte-kit/tsconfig.json",
33
"compilerOptions": {
44
"allowJs": true,
5+
"allowImportingTsExtensions": true,
56
"checkJs": true,
67
"esModuleInterop": true,
78
"forceConsistentCasingInFileNames": true,

0 commit comments

Comments
 (0)