-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
Replace moment specifier with format/parse functions #518
Conversation
Codecov Report
@@ Coverage Diff @@
## master #518 +/- ##
========================================
+ Coverage 99.48% 100% +0.51%
========================================
Files 15 15
Lines 581 608 +27
Branches 123 129 +6
========================================
+ Hits 578 608 +30
+ Misses 3 0 -3
Continue to review full report at Codecov.
|
Thanks for this PR! I was thinking to provide a default format, e.g. I was reasoning about writing a small utility that could recognize |
@TrySound also I believe const parse = (string, locale) => { return 'parsedDate' };
const format = (date, locale) => { return 'string' };
<DayPickerInput
dayPickerProps={{ locale: 'ru' }}
format={format}
parse={parse}
/> This would help developers to implement their own i18n. |
Maybe better to pass date objects directly and use internal format and parser for simple specifer as defaults. So you don't need to expose these defaults to let users understand date. |
Not sure I follow – what do you mean? |
|
OK, this is another change we can consider, and it makes sense – as it is somewhat related to #508 ("Move input related props to Until now, the |
I also think we should open a There are still some fixes to do on v6 that I would like to publish before other breaking changes. |
Hi guys, where do we stand with this? Do we have a date in mind for v7? I rly think getting rid of this moment dep is high priority |
@PeterKottas me too :) The problem is that there's a pending minor release, I'm working on it right now. I'd like to release this minor version where you can optionally opt out from moment. I.e., it defaults to moment, but if you specify |
Oh that sounds cool. You should definitely be able to do that. Just require the module, then check if it's define before you use it and fallback to some detetime format. I think you already have logic for that there. It would however need to remain a peer dependency which scares some people away. But it it's only for now, I'd go for it. |
# Conflicts: # src/DayPickerInput.js
Replace moment specifier with format/parse functions
This PR will remove moment dependency in favour of parse and format helpers which can be handled with library chosen in a team.