Skip to content

Commit

Permalink
fix:Add utcOffset to handlebars dateformat helper
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gijswijs committed May 28, 2020
1 parent 76c0c6c commit 9c60d23
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var slug = require('slug');

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

describe('metalsmith-tags', function() {
Expand Down

0 comments on commit 9c60d23

Please sign in to comment.