-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Doc(Migration): Add a migration guide
Initialized with the Date migration guide.
- Loading branch information
Olivier YOUF
committed
Oct 23, 2020
1 parent
431b188
commit b07046e
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<h1>Migration Guide</h1> | ||
|
||
- [From version 1.x to 2.0.x](#from-version-1x-to-20x) | ||
- [Date Input](#date-input) | ||
|
||
# From version 1.x to 2.0.x | ||
|
||
## Date Input | ||
|
||
We updated the React DatePicker from 1.X to 3.X. The library no longer uses moment. The library uses DateFns as dependency for the date management. Therefore, The Date Input no longer uses moment object for the value, but a Javascript Date object. Also, the onChange Callbackk return a Date value instead of a moment Value. | ||
|
||
We also added a *format* param wich permit to specify the way to diplay value in viewvalue and in the field. He have to be a [unicode format](https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table) | ||
|
||
In 1.X : | ||
|
||
```javascript | ||
<DateInput | ||
label='Enter en date' | ||
locale='fr-fr' | ||
value={moment('11/26/2017', 'MM/DD/YYYY')} | ||
/> | ||
``` | ||
|
||
In 2.0.x | ||
|
||
```javascript | ||
<DateInput | ||
label='Enter en date' | ||
locale='fr-FR' | ||
value={new Date('11-26-2017')} | ||
format='dd/MM/yyyyy' | ||
/> | ||
``` | ||
|
||
|
||
|
||
|