Skip to content

Commit 9c60d23

Browse files
committed
fix:Add utcOffset to handlebars dateformat helper
Tests fail because the dateFormat helper uses the local timezone for formatting the date. This results in unexpected dates, if the local time is still in the day before or already in the day after, compared to the UTC date in the source.
1 parent 76c0c6c commit 9c60d23

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var slug = require('slug');
99

1010
Handlebars.registerHelper('dateFormat', function(context, format) {
1111
var f = format || 'DD/MM/YYYY';
12-
return moment(new Date(context)).format(f);
12+
return moment(new Date(context)).utcOffset('+0000').format(f);
1313
});
1414

1515
describe('metalsmith-tags', function() {

0 commit comments

Comments
 (0)