nazar-pc / PickMeUp

Really simple, powerful, customizable and lightweight standalone datepicker
BSD Zero Clause License
616 stars 190 forks source link

Add ability to "select last day of month" from the calendar view. #218

Closed jsmolens closed 5 years ago

jsmolens commented 5 years ago

Add ability to "select last day of month" from the calendar view.

Why is this useful? In my application, I want to select the year and month and have the calendar give me a formatted date with the last day of that month instead of the first.

nazar-pc commented 5 years ago

But if you need just year and a month, why do you care about day of the month at all? Seems to be too narrow of a use case and you can always do whatever formatting you want in even handler on date change.

jsmolens commented 5 years ago

I agree that it’s a narrow use case, but the application needs the year, month, and day to go into an existing field in a database. The format string with a “last day of the month” works perfectly in this use case.

What’s nice about this solution is that it allows one to use the PickMeUp calendar in fields that have this last day requirement as well as in fields where the application requires “any legal day”, which is, of course the more common use case.

On Jun 29, 2019, at 2:56 PM, Nazar Mokrynskyi notifications@github.com wrote:

But if you need just year and a month, why do you care about day of the month at all? Seems to be too narrow of a use case and you can always do whatever formatting you want in even handler on date change.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

nazar-pc commented 5 years ago

Got it. Please add support for this formatting to parse_date function as well, it would behave just like d. Then I can merge it.

jsmolens commented 5 years ago

Sure thing - I added support in parse_date() and added a comment.

nazar-pc commented 5 years ago

Thanks for contribution!