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

feat(calendar): "get date" can return formatted date #3141

Merged
merged 5 commits into from
Dec 26, 2024

Conversation

dreaming-augustin
Copy link
Contributor

$('.ui.calendar').calendar('get date');
$('.ui.calendar').calendar('get focusDate');
$('.ui.calendar').calendar('get startDate');
$('.ui.calendar').calendar('get endDate');

could so far only return a Javascript Date object.

Now, given a format argument, they return a formatted date string:

$('.ui.calendar').calendar('get date',      "YYYY-MM-DD");
$('.ui.calendar').calendar('get focusDate', "YYYY-MM-DD");
$('.ui.calendar').calendar('get startDate', "YYYY-MM-DD");
$('.ui.calendar').calendar('get endDate',   "YYYY-MM-DD");

The format string is passed to the existing formatter.

This is backward compatible as the default behaviour does not change.

It makes it convenient for developers to get exactly what they need when they need it.

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments / suggestions.
The new code is now somewhat duplicated four times (using a different metadata value) we should even think of putting that in a unique function

src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
src/definitions/modules/calendar.js Outdated Show resolved Hide resolved
@lubber-de lubber-de added type/feat Any feature requests or improvements state/awaiting-docs Pull requests which need doc changes/additions javascript Pull requests that update Javascript code labels Dec 25, 2024
@dreaming-augustin
Copy link
Contributor Author

dreaming-augustin commented Dec 26, 2024

  1. Default function parameter values are not supported in IE11 (which FUI 2.9.x still supports)

Ok. I am not fluent in JavaScript. I think more in term of C++, so I couldn't imagine parameters that were undefined.

@dreaming-augustin
Copy link
Contributor Author

dreaming-augustin commented Dec 26, 2024

The new code is now somewhat duplicated four times (using a different metadata value) we should even think of putting that in a unique function

Done. You may suggest another function name...

Copy link
Member

@lubber-de lubber-de left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but cleaner! LGTM
Please take a short look at your docs PR where i was already commenting fomantic/Fomantic-UI-Docs#524

@lubber-de
Copy link
Member

Docs added by fomantic/Fomantic-UI-Docs#524

@lubber-de lubber-de added state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo and removed state/awaiting-docs Pull requests which need doc changes/additions labels Dec 26, 2024
@dreaming-augustin
Copy link
Contributor Author

Thank you for your reviews.
I apologize for dumping so many PR just before Christmas!
I hope you had/are having great holidays.

@lubber-de lubber-de added this to the 2.9.4 milestone Dec 26, 2024
@lubber-de lubber-de changed the title [Calendar] "get date" can return formatted date feat(calendar): "get date" can return formatted date Dec 26, 2024
@lubber-de lubber-de merged commit 21d259d into fomantic:develop Dec 26, 2024
11 checks passed
lubber-de added a commit that referenced this pull request Dec 26, 2024
Added types for the new optional format parameters for calendars get date functions as of #3141
@dreaming-augustin dreaming-augustin deleted the calendar branch December 29, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants