-
-
Notifications
You must be signed in to change notification settings - Fork 103
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(datepicker): add possibility for a format function to Datepicker #153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
#151 related
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Well, the check failing because there's a problem with your commit messages
What do you think about these commit messages? @ChildishGiant
It's just an issue of the case, which doesn't overly matter. I might change the action to only give a warning as it's not a massive deal if the commits aren't the right style. |
Should a format-function not have a |
hmm wait, I don't get it. What do you mean? |
Haven't yet looked at your pull request, but I guess it's probably already possible: M.Datepicker.init(elems, {
format: (date, fmt) => new Intl.DateTimeFormat(locale, fmt).format(date)
}); |
@ray007 and what value should the If you add a format function, why should it not be possible for that function to know how to format itself? |
bfa957a
to
5ad735c
Compare
5ad735c
to
27620cc
Compare
So, I finally fixed those commit linting problems :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small typo, rest looks good to me.
To leverace browser own internationalization methods, it is useful to add a format method instead of simple format string. That makes things like this possible: ```js M.Datepicker.init(elems, { format: date => new Intl.DateTimeFormat(locale).format(date) }); ``` Which would format the input according to the i18n rules defined by the browser using the locale of the user.
27620cc
to
88c0b7e
Compare
So, let's see if I can finally pass the bouncer of a commit linter. |
Anyone like to approve the workflow? :-) |
Oh yeah, I did approve it. Hmm.... I assume the issue that mentioned by @ray007 is already solved (there is no reply since a month). Merging it now. |
Anyway, I sent an invitation to you to join the @materializecss/members team. Welcome 🎉 |
To me it said, it waited for approval for the workflows, that's why I wrote again. :-) |
I have probably manually triggered them a few days or weeks ago. |
Proposed changes
This is described in #151. In short: This adds the ability to add a formatting function as format option to datepicker instance, which allows things like this:
Types of changes
Checklist: