- Fixed bug with UTC date on daylights savings time #94
- Fixed missing source map
- Fixed security y18n
Added isoDate and isoDateTime masks
Added Z format/parse and fixed Peru timezone issue
- Added
Z
format token. See readme for more info. Big thanks to @fer22f for writing the code. - Fixed a strange issue when Peru changed timezones in 1990. See #78
Major Features and Breaking changes in this version
- Valid date parsing - By default fecha will check validity of dates. Previously
2019-55-01
or2019-01-42
would parse correctly, since Javascript can handle it. Now invalid dates will returnnull
instead - ES Module and Tree Shaking Support - You can now import fecha
parse
orformat
independently
import {format, parse} from 'fecha';
format(...);
parse(...)
parseDate
may returnnull
when previously returned aDate
. See improvements above, but invalid dates will returnnull
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'
});
- Fixed bug when using brackets when parsing dates
- Fixed issue where src files are not included correctly in npm
- Moved to ES modules
- Changed invalid date from
false
tonull
Fixed bug with year 999 not having leading zero
Added typescript definitions to NPM
Added strict version of date parser that returns null on invalid dates (may use strict version in v3)
Fixed a bug when parsing Do format dates
Fecha now throws errors on invalid dates in fecha.format
and is stricter about what dates it accepts. Dates must pass Object.prototype.toString.call(dateObj) !== '[object Date]'
.