2014-11-01 18:00:46 +01:00
|
|
|
/* global moment */
|
2014-10-30 21:44:22 +01:00
|
|
|
|
2014-10-25 00:59:06 +02:00
|
|
|
export default function(date, options) {
|
2015-08-01 13:51:04 +02:00
|
|
|
if (options === undefined) {
|
|
|
|
options = {};
|
|
|
|
}
|
|
|
|
if (options.hash === undefined) {
|
|
|
|
options.hash = {};
|
|
|
|
}
|
|
|
|
|
2014-10-25 00:59:06 +02:00
|
|
|
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 {
|
2015-08-01 13:51:04 +02:00
|
|
|
return moment(date).format(
|
2015-08-01 22:43:06 +02:00
|
|
|
moment.localeData().longDateFormat(format)
|
2015-08-01 13:51:04 +02:00
|
|
|
.replace(
|
|
|
|
moment.localeData().longDateFormat('LT'), '')
|
|
|
|
.trim()
|
|
|
|
);
|
2014-10-25 00:59:06 +02:00
|
|
|
}
|
2015-08-01 13:51:04 +02:00
|
|
|
}
|