Skip to content

Commit

Permalink
use miliseconds to subtract
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Dudek committed Sep 20, 2018
1 parent 18f7172 commit a1d13ad
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions __tests__/index.js
Expand Up @@ -235,15 +235,7 @@ describe('Manipulate', () => {

it('Subtract', () => {
const m = moment(time).subtract(7, 'days');
const n = new Date(
new Date(time).getFullYear(),
new Date(time).getMonth(),
new Date(time).getDate() - 7,
new Date(time).getHours(),
new Date(time).getMinutes(),
new Date(time).getSeconds(),
new Date(time).getMilliseconds()
);
const n = new Date(new Date(time).getTime() - 1000 * 60 * 60 * 24 * 7);
const d = date.subDays(new Date(time), 7);
const day = dayjs(time).subtract(7, 'day');
expect(m.valueOf()).toBe(d.getTime());
Expand Down

0 comments on commit a1d13ad

Please sign in to comment.