Skip to content

Commit

Permalink
Merge pull request 'fix-pathname-ts-warning' (#7) from sultanmyrza/ru…
Browse files Browse the repository at this point in the history
…nning-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]>
  • Loading branch information
Caleb Rogers committed May 28, 2024
2 parents afffdd0 + f87f4d7 commit 2e9ca99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
let pathname = '';
page.subscribe(($page) => (pathname = $page.url.searchParams.get('date')));
page.subscribe(($page) => {
const date = $page.url.searchParams.get('date');
pathname = date ?? new Date().toDateString();
});
// If the date query param is somehow invalid, try to set it to today
if (!pathname || typeof pathname !== 'string' || isNaN(new Date(pathname).valueOf())) {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"allowImportingTsExtensions": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
Expand Down

0 comments on commit 2e9ca99

Please sign in to comment.