date-fns
Version:
Modern JavaScript date utility library
21 lines (19 loc) • 634 B
JavaScript
var accusativeWeekdays = ['neděli', 'pondělí', 'úterý', 'středu', 'čtvrtek', 'pátek', 'sobotu'];
var formatRelativeLocale = {
lastWeek: "'poslední' eeee 've' p",
yesterday: "'včera v' p",
today: "'dnes v' p",
tomorrow: "'zítra v' p",
nextWeek: function (date, _baseDate, _options) {
var day = date.getUTCDay();
return "'v " + accusativeWeekdays[day] + " o' 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;
}