thelounge/test/client/js/libs/handlebars/localetimeTest.js
Pavel Djundik fb87bd3a58 Webpack
2016-12-27 19:15:30 +02:00

22 lines
593 B
JavaScript

"use strict";
const expect = require("chai").expect;
const localetime = require("../../../../../client/js/libs/handlebars/localetime");
describe("localetime Handlebars helper", () => {
it("should render a human-readable date", () => {
// 12PM in UTC time
const date = new Date("2014-05-22T12:00:00");
// Offset between UTC and local timezone
const offset = date.getTimezoneOffset() * 60 * 1000;
// Pretend local timezone is UTC by moving the clock of that offset
const time = date.getTime() + offset;
expect(localetime(time)).to.equal("5/22/2014, 12:00:00 PM");
});
});