dojo / widgets

:rocket: Dojo - UI widgets.
https://widgets.dojo.io
Other
88 stars 66 forks source link

support more date formats and custom date parsers #1712

Closed aciccarello closed 3 years ago

aciccarello commented 3 years ago

Type: bug

The following has been addressed in the PR:

Description: Adds support for more date formats and the ability to pass a custom date parser. This resolves an issue with the date handling outside of a few select locales and adds support for several common date formats (as defined by Intl.DateTimeFormat().format()). For other locales or for more flexible date parsing (such as to support multiple formats at once), a custom date formatter/parser combo can be passed.

For locales where Intl.DateTimeFormat().format() produces something that is not supported, selecting a date from the calendar was resulting in an invalid date warning. This was because the Date value is formatted as a string using DateTimeFormat and later parsed. The fix was adding a check to the date-to-string formatter that avoids outputting un-parseable strings and defaults to ISO strings.

Resolves #1563

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

widget-test-docs – ./

🔍 Inspect: https://vercel.com/dojo/widget-test-docs/DaDub1MQky9X6dTgze4pNSpJdn6k
✅ Preview: https://widget-test-do-git-fork-aciccarello-1563-intl-date-inpu-c7c5af.vercel.app

dojo.widgets – ./

🔍 Inspect: https://vercel.com/dojo/dojo.widgets/8viT7V7R7e9UZYfdAeNzH572a7Ja
✅ Preview: https://dojowidgets-git-fork-aciccarello-1563-intl-date-input-dojo1.vercel.app

codecov[bot] commented 3 years ago

Codecov Report

Merging #1712 (fd480a6) into master (8bade73) will decrease coverage by 0.00%. The diff coverage is 96.55%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1712      +/-   ##
==========================================
- Coverage   90.05%   90.05%   -0.01%     
==========================================
  Files          94       94              
  Lines        5050     5077      +27     
  Branches     1373     1384      +11     
==========================================
+ Hits         4548     4572      +24     
- Misses        249      251       +2     
- Partials      253      254       +1     
Impacted Files Coverage Δ
src/date-input/date-utils.tsx 97.36% <94.11%> (-2.64%) :arrow_down:
src/date-input/index.tsx 91.37% <100.00%> (+0.30%) :arrow_up:
src/loading-indicator/index.tsx 88.46% <0.00%> (-11.54%) :arrow_down:
src/text-input/index.tsx 92.68% <0.00%> (-0.24%) :arrow_down:
src/time-picker/index.tsx 81.81% <0.00%> (ø)
src/password-input/index.tsx 78.57% <0.00%> (ø)
src/chip-typeahead/index.tsx 89.71% <0.00%> (+0.09%) :arrow_up:
src/select/index.tsx 86.95% <0.00%> (+0.86%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8bade73...fd480a6. Read the comment docs.