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

Selecting date range becomes non inclusive if end date is selected first #1504

Open
ventralnet opened this issue Oct 24, 2024 · 1 comment
Open

Comments

@ventralnet
Copy link

https://github.com/ventralnet/vue-sandbox/tree/v-calendar-sandbox

Initializing the date range with zero times then selecting the end date, then in the calendar select start date. Start date 'time' will be 23:59:59 and end date time will be 0:0:0:0.

I would expect the times to be 0:0:0:0 -> 23:59:59

<template>
  <date-picker 
    v-model.range="dateRange"
    mode="datetime"
    is24hr
  />
</template>

....

<script setup>
import { DatePicker } from 'v-calendar';
import 'v-calendar/style.css';
import { reactive } from 'vue';

const todayMinTime = () => {
  let date = new Date();
  date.setHours(0,0,0,0);
  return date;
};

const todayMaxTime = () => {
  let date = new Date();
  date.setHours(23, 59, 59, 0);
  return date;
};

const dateRange = reactive({
  start: todayMinTime(),
  end: todayMaxTime(),
});

</script>
@tommed
Copy link

tommed commented Dec 5, 2024

Same. There's no real way to fix this as you can't tell the difference between a user using the time fields to set this 1min window, or this incorrect behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants