Skip to content

Upgrade from 2.1.2 to 3.0.0, the Luxon object stopped working properly as the defaultValue #100

@Jahoda

Description

@Jahoda

Describe the bug

This code was working normally in the previous version:

import { DateTime } from 'luxon'

const to = queryParam(
  'to',
  {
    decode: (value) => DateTime.fromISO(value),
    encode: (value) => value.toISO(),
    defaultValue: DateTime.now(),
  },
  { showDefaults: false },
)

In version 3.0.0, the Luxon object has somehow been transformed, causing basic methods to become unavailable. For example, $to.startOf('month') no longer works.

I'm afraid that this is a side effect of the recent changes.

#89
#87

Is there a workaround, or should I use it in a different way?

Thank you!

Reproduction

See the result in the console:

3.0.0 (error): https://stackblitz.com/edit/sveltejs-kit-template-default-nu1tgv?file=src%2Froutes%2F%2Bpage.svelte
2.1.2 (working): https://stackblitz.com/edit/sveltejs-kit-template-default-uy9ugg?file=src%2Froutes%2F%2Bpage.svelte

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions