UNPKG

date-fns

Version:

Modern JavaScript date utility library

21 lines (19 loc) 587 B
var formatRelativeLocale = { lastWeek: function (date, _baseDate, _options) { var weekday = date.getUTCDay(); var last = weekday === 0 || weekday === 6 ? 'último' : 'última'; return "'" + last + "' eeee 'às' p"; }, yesterday: "'ontem às' p", today: "'hoje às' p", tomorrow: "'amanhã às' p", nextWeek: "eeee 'às' p", other: 'P' }; export default function formatRelative(token, date, baseDate, options) { var format = formatRelativeLocale[token]; if (typeof format === 'function') { return format(date, baseDate, options); } return format; }