Skip to content

Instantly share code, notes, and snippets.

@dp21g
Last active January 23, 2018 11:17
Show Gist options
  • Save dp21g/3486fbd82757ef243e41b3f6079fc06e to your computer and use it in GitHub Desktop.
Save dp21g/3486fbd82757ef243e41b3f6079fc06e to your computer and use it in GitHub Desktop.
// jest tests
describe("getTickValues method", () => {
const dispformat = "DD-MMM-YYYY hh:mm";
beforeAll(() => {
moment.tz.setDefault("Europe/London");
});
it("generates tick values with DST", () => {
const d1 = new Date("2017-10-29T00:26:00Z"); //UTC time
const d2 = new Date("2017-10-29T02:12:00Z"); //UTC time
const expectedValue = "29-Oct-2017 01:00";
expect(moment(getDSTDate(d1, d2)).format(dispformat)).toEqual(
expectedValue
);
});
afterAll(() => {
moment.tz.setDefault();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment