Package Exports
- @shelf/datetime
- @shelf/datetime/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@shelf/datetime) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Shelf DateTime
Migration from @shelf/dates to @shelf/datetime - https://gemshelf.atlassian.net/wiki/spaces/PD/pages/3588980797/Migration+from+shelf+dates+to+shelf+datetime+date-fns+-+dayjs
import {setGlobalLocale, formatDistance} from '@shelf/datetime';
// OR
import setGlobalLocale from '@shelf/datetime/lib/setGlobaleLocale';
import formatDistance from '@shelf/datetime/lib/formatDistance';
setGlobalLocale('uk'); // set non-default locale (default 'en')
formatDistance(
new Date(1986, 3, 4, 10, 32, 0),
new Date(1986, 3, 4, 10, 32, 20)
); // декілька секунд назад
setGlobalLocale('en');
formatDistance(
new Date(1986, 3, 4, 10, 32, 0),
new Date(1986, 3, 4, 10, 32, 20)
); // a few seconds ago