UNPKG

776 BJavaScriptView Raw
1var path = require('path'),
2 _ = require('underscore'),
3 moment = require('moment-timezone');
4
5function htmlfiles(files) {
6 return _.pick(files, function(file, filename) {
7 return (path.extname(filename) === '.html');
8 });
9}
10
11function format_date(datetime, format, utc) {
12 var common_formats = {
13 normal: "M/D/YYYY",
14 name: "DD MMM YYYY",
15 proposal: "M/YYYY",
16 blog: "DD MMM YYYY [at] HH:mm [EST]",
17 xml: "ddd, DD MMM YYYY HH:mm:ss ZZ"
18 };
19 format = common_formats[format] || format;
20 if (utc === undefined) {
21 utc = true;
22 }
23 if (utc) {
24 return moment.utc(datetime).format(format);
25 } else {
26 return moment.utc(datetime).tz("America/New_York").format(format);
27 }
28}
29
30exports.htmlfiles = htmlfiles;
31exports.format_date = format_date;