Skip to content

Commit de0d52e

Browse files
committed
Changes after comments on #138.
1 parent 2887ef8 commit de0d52e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/routes/projects/create.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ function createProjectAndPhases(req, project, projectTemplate, productTemplates)
9393
});
9494
return Promise.all(_.map(phases, (phase, phaseIdx) => {
9595
const duration = _.get(phase, 'duration', 1);
96-
const startDate = moment.utc();
96+
const startDate = moment.utc().hours(0).minutes(0).seconds(0)
97+
.milliseconds(0);
9798
// Create phase
9899
return models.ProjectPhase.create({
99100
projectId: newProject.id,

src/routes/projects/create.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,12 @@ describe('Project create', () => {
446446
phases[0].status.should.be.eql('open');
447447
phases[0].startDate.should.be.a('string');
448448
phases[0].duration.should.be.eql(10);
449-
new Date(phases[0].endDate).should.be.eql(moment.utc(phases[0].startDate).add(9, 'days').toDate());
449+
const startDate = moment.utc(phases[0].startDate);
450+
startDate.hours().should.be.eql(0);
451+
startDate.minutes().should.be.eql(0);
452+
startDate.seconds().should.be.eql(0);
453+
startDate.milliseconds().should.be.eql(0);
454+
new Date(phases[0].endDate).should.be.eql(startDate.add(9, 'days').toDate());
450455
expect(phases[0].details).to.be.empty;
451456
phases[0].products.should.have.lengthOf(1);
452457
phases[0].products[0].name.should.be.eql('product 1');

0 commit comments

Comments
 (0)