Skip to content

Strict Dates and ES Module Support

Compare
Choose a tag to compare
@taylorhakes taylorhakes released this 06 Jan 00:25
· 1 commit to 4.0.0-beta.0-changes since this release

Major Features and Breaking changes in this version

Improvements

  • Valid date parsing - By default fecha will check validity of dates. Previously 2019-55-01 or 2019-01-42 would parse correctly, since Javascript can handle it. Now invalid dates will return null instead
  • ES Module and Tree Shaking Support - You can now import fecha parse or format independently
import {format, parse} from 'fecha';

format(...);
parse(...)

Breaking changes

  • parseDate may return null when previously returned a Date. See improvements above, but invalid dates will return null now
  • Change to how to set masks and i18n
    Previously
import fecha from 'fecha';

fecha.i18n = { ... }
fecha.masks.myMask = 'DD , MM, YYYY' 

New

import {parse, format, setGlobalDateI18n, setGlobalDateMasks} from 'fecha';

setGlobalDateI18n({
    // ...
})
setGlobalDateMasks({
  myMask: 'DD , MM, YYYY'
});