Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(VDatePicker): Fix month text format when using adapter #19198

Conversation

MichaelGoff
Copy link

@MichaelGoff MichaelGoff commented Feb 8, 2024

Description

When using the Luxon adapter we found that for single digit months we were getting and "Invalid DateTime" on the month text. It turned out to be an issue with the date format passed to the format function in the text computed. Luxon is expecting an ISO-8601 formatted string and was rejecting the month without a leading zero.

This change formats the month into a 2 digit format for proper date parsing.

fixes #19196

Markup:

<template>
  <v-app>
    <v-container>
      <v-date-picker />
    </v-container>
  </v-app>
</template>

<script>
  export default {
    name: 'Playground',
  }
</script>

<style lang="scss">

</style>

I merge the custom `types` prop into the `rootTypes` and set that as a computed to keep it reactive.

I opted to move the gen* functions into setup to inherit the `mergedTypes` computed rather than pass it around as an extra parameter. Happy to set it up as a parameter instead if desired.
Fixes "Improper DateTime" error on month text when using Luxon adapter library

fixes vuetifyjs#19196
@MajesticPotatoe MajesticPotatoe added T: bug Functionality that does not work as intended/expected C: VDatePicker VDatePicker labels Feb 9, 2024
@hamedfaryabi
Copy link

any update on this problem?

@KaelWD KaelWD closed this in 0f6850c Feb 14, 2024
VIXI0 pushed a commit to VIXI0/vuetify that referenced this pull request Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDatePicker VDatePicker T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report][3.5.3] (VDatePicker) Improper month text format when using Luxon 3rd party adapter
3 participants