date-fns
Version:
Modern JavaScript date utility library
26 lines (22 loc) • 733 B
JavaScript
var accusativeWeekdays = ['vasárnap', 'hétfőn', 'kedden', 'szerdán', 'csütörtökön', 'pénteken', 'szombaton'];
function week(isFuture) {
return function (date, _baseDate, _options) {
var day = date.getUTCDay();
return (isFuture ? '' : "'múlt' ") + "'" + accusativeWeekdays[day] + "'" + " p'-kor'";
};
}
var formatRelativeLocale = {
lastWeek: week(false),
yesterday: "'tegnap' p'-kor'",
today: "'ma' p'-kor'",
tomorrow: "'holnap' p'-kor'",
nextWeek: week(true),
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;
}