Formats your date for you!
npm i @hgalvao/date-helper --save
Then...
import DateHelper from '@hgalvao/date-helper';
<DateHelper date={"1995,12,2"} format="DDMMYYYY" divider='-' yearsDigit='short' />
Will return: 2-11-95
DateHelper can have multiple formats supported:
- DDMMYYYY
- MMDDYYYY
- MMYYYY
- DDMM
- MMDD
- MM
- DD
- YYYY
Dates need to follow the following formats to be supported:
- "December 17, 1995"
- "1995-12-17"
- 1995,11,17
- 1995,11,17,3,24,0
The yearsDigit is set default to 'long' and will return the years with 4 digits. However, it accepts yearsDigit='short' to return the years with 2 digits only