diff --git a/tests/helpers.js b/tests/helpers.js index 2c2306e..03faf1f 100644 --- a/tests/helpers.js +++ b/tests/helpers.js @@ -600,6 +600,26 @@ describe('Helper `formatDate`', function () { }); }); + it('should return a formatted string of date and time when timestamp is passed as string', function () { + var tmpl = '{@formatDate val="' + timeStamp + '" locales="en-US" month="long" day="2-digit" year="numeric" hour="numeric" minute="numeric" timeZone="UTC"/}', + ctx = {}, + expected = 'January 23 2014 11:00 PM', + d = new Date(timeStamp); + Dust.renderSource(tmpl, ctx, function(err, out) { + expect(out).to.equal(expected); + }); + }); + + it('should return a formatted string of date and time when timestamp is passed as number', function () { + var tmpl = '{@formatDate val=' + timeStamp + ' locales="en-US" month="long" day="2-digit" year="numeric" hour="numeric" minute="numeric" timeZone="UTC"/}', + ctx = {}, + expected = 'January 23 2014 11:00 PM', + d = new Date(timeStamp); + Dust.renderSource(tmpl, ctx, function(err, out) { + expect(out).to.equal(expected); + }); + }); + it('should return a formatted string of just the time using different locales', function () { var tmpl = '{@formatDate val=' + timeStamp + ' hour="numeric" minute="numeric" timeZone="UTC" locales="de-DE"/}', ctx = {},