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 crash when select date range with external adapter #19336

Conversation

SonTT19
Copy link
Contributor

@SonTT19 SonTT19 commented Mar 5, 2024

Description

fixes #19330

Markup:

<template>
  <v-container>
    <v-row justify="space-around">
      <v-date-picker color="primary" multiple="range"></v-date-picker>
    </v-row>
  </v-container>
</template>

use date-io/dayjs adapter

import { createVuetify } from 'vuetify'
import DayJsAdapter from '@date-io/dayjs'

export const vuetify = createVuetify({
  date: { adapter: DayJsAdapter },
})

@johnleider johnleider added this to the v3.5.x milestone Mar 5, 2024
@johnleider johnleider added T: bug Functionality that does not work as intended/expected C: VDatePicker labels Mar 5, 2024
@johnleider
Copy link
Member

Message me on Discord please, ty!

@KaelWD
Copy link
Member

KaelWD commented Mar 5, 2024

This should default to ms too

function getDiff (date: Date, comparing: Date | string, unit?: string) {
const d = new Date(date)
const c = new Date(comparing)
if (unit === 'month') {
return d.getMonth() - c.getMonth() + (d.getFullYear() - c.getFullYear()) * 12
}
return Math.floor((d.getTime() - c.getTime()) / (1000 * 60 * 60 * 24))
}

@johnleider johnleider merged commit 2a739b9 into vuetifyjs:master Mar 5, 2024
10 checks passed
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 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.7] v-date-picker with dayjs crashes when using range selector
3 participants