decide.nolog.cz/app/helpers/formatted-date.js
2015-08-01 22:43:06 +02:00

24 lines
568 B
JavaScript

/* global moment */
export default function(date, options) {
if (options === undefined) {
options = {};
}
if (options.hash === undefined) {
options.hash = {};
}
var times = options.hash.times ? options.hash.times : false,
format = options.hash.format ? options.hash.format : 'LLLL';
if (times === true) {
return moment(date).format( format );
}
else {
return moment(date).format(
moment.localeData().longDateFormat(format)
.replace(
moment.localeData().longDateFormat('LT'), '')
.trim()
);
}
}