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

[BUG] It's possible to navigate to a month outside of your allowed date-range on calendar type multiple #344

Open
LennertJ opened this issue Dec 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@LennertJ
Copy link

LennertJ commented Dec 12, 2024

First of all I want to thank you for the amazing package you've created!

I encountered this bug in version 2.9.6.
To check if I could fix it in the latest release (3.0.1) I've recreated a minimalist demo of my problem on the live-editor of your docs page.

import { Calendar, type Options } from 'vanilla-calendar-pro';

import 'vanilla-calendar-pro/styles/index.css';

const options: Options = {
  dateMin: '2024-12-01',
  dateMax: '2024-12-31',
  type: 'multiple',
};

const calendar = new Calendar('#calendar', options);
calendar.init();

This code should generate a vanilla calendar instance with 2 calendars and the days you can select are limited to the month of December 2024.
Since the time is limited to a single month in a single year I can't use the arrows, year or month buttons to jump to a different month, this is the behavior I expected. However If i use the month-picker in the second calendar I'm able to jump to months outside of the allowed range (December 2024).

I've provided 2 screenshots as an illustration of the issue

Left calendar with the 'expected' behavior:
image

Right calendar with the 'unexpected' behavior:
image

It's a tiny bug with a small impact since it only happens for the calendar with type multiple and even then not with all allowed dateranges. And you still can't select disallowed dates and can easily return to your allowed timerange. But I might as well report it since it's not the behavior I expected.

https://codesandbox.io/p/sandbox/agitated-panka-9gf6tq

@LennertJ LennertJ added the bug Something isn't working label Dec 12, 2024
@uvarov-frontend
Copy link
Owner

Thanks for the report, I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants