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 Fix: Month Selector and Week Selector #46

Merged
merged 3 commits into from
Mar 21, 2024

Conversation

alexandrevega
Copy link
Contributor

There's a bug when altInput is true while using monthSelector or weekSelector.
Also, dateFormats are being forced on both, ignoring user's dateFormat().
I implemented a fix using same approach as https://github.com/savannabits/filament-flatpickr/blob/c1a74870e9056988ad001955ac7674c090f11ac0/src/Forms/Components/Flatpickr.php#L141C3-L143

However, this doesn't fix altInput, enabling this option while using weekSelector or monthSelector will make it crash as seen in #45 .
I'll take a deeper look into fixing altInput, as for now this should allow many people to use both features.

@what-the-diff
Copy link

what-the-diff bot commented Sep 18, 2023

PR Summary 📝

  • A Change in the Date Picker Function 🗓️
    We've made improvements to a function called flatpickrDatepicker which is found in the flatpickr.js file. What it does is simply give you better control over the format of the date on the user interface. These changes ensure that this function adapts better to the configuration of the project/platform it's being used on.

  • Smart Date Formatting 🧠
    In a file called Flatpickr.php, we've added a smart feature that checks the format of the date. If the format contains the letter "d", the default format is set appropriately. This translates to a user-friendly experience where the date format automatically adjusts to what's most useful in the situation.

@dave-mills
Copy link
Contributor

I'm very keen for this PR! Love this plugin - flatpickr is a great little utility for slightly non-standard date inputs, like week selects and date ranges. This PR makes the week select feature so much more usable, as I can then customise the output ("Week 1" doesn't mean much to my users, but "Week starting 2024-01-01" does, so I really want to use my own date formats!)

@alexandrevega I also took a look at the altInput issue - see #51.

@tudorr89
Copy link

+1 looking forward to this fix!

@coolsam726 coolsam726 merged commit 62a872c into savannabits:3.x Mar 21, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants