[bug] Tanstack Router: `parseAsTimestamp` parses defalt value as `1970-01-01T00:00:02.025Z` when reloaded or opened with searchParams
- Lingua principale
- TypeScript
- Stelle
- 10.8k
- Fork
- 294
- Merge medio
- 1g 16h
- PR unite (30g)
- 21
Descrizione
## Context
What's your version of `nuqs`?
```
"nuqs": "^2.7.2"
```
What framework are you using?
- ✅ Other (Tanstack Router)
Which version of your framework are you using?
```
"@tanstack/react-router": "^1.132.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
```
## Description
**BUG**: When query states is changed to `?from=1760207400000&to=1760812199999` and I reload the page or open the same URL in different tab, it fails to parse the value and changes the url to `?from="1970-01-01T00%3A00%3A02.025Z"&to="1970-01-01T00%3A00%3A02.025Z"`
**EXPECTED**: URL to be same and parse the timestamps correctly.
However this only happens when I add `validateSearch` in route definition
```ts
export const Route = createFileRoute("/")({
component: App,
// THE BUG ONLY HAPPENS WHEN USING validateSearch IF I REMOVE `validateSearch` IT WORKS AS EXPECTED
validateSearch: createStandardSchemaV1(searchParams, {
partialOutput: true,
}),
});
```
## Reproduction
Deployed Version: https://nuqs-repro.pages.dev/
GitHub Repo: https://github.com/mdhruvil/nuqs-repro
- Visit "/"
- Current Week is selected by default, see URL and values displayed on page
- Click on "Set to Previous Week"
- It changes url to select previous week (works as expected)
- Refresh the page or copy url and open in new tab
- It changes url to `?from="1970-01-01T00%3A00%3A02.025Z"&to="1970-01-01T00%3A00%3A02.025Z"` instead of parsing the actual timestamp values
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.