Skip to content

Commit

Permalink
Merge pull request #108 from sinfo/fix-event-duration
Browse files Browse the repository at this point in the history
fix: event duration
  • Loading branch information
andreromao authored Feb 25, 2024
2 parents fea8b44 + 6c58a7a commit 0b5abaa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/app/company/welcome/date-en.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ export class DateEnPipe implements PipeTransform {
return `${startMonth} ${startDay}${startTerm} `;
}

const endDate = new Date(start.getTime() + end.getTime());

const endDay = endDate.getDate();
const endMonth = this.translator[endDate.getMonth()];
const endDay = end.getDate();
const endMonth = this.translator[end.getMonth()];

var endTerm
if(endDay === 1 || endDay === 21 || endDay === 31){
Expand Down
6 changes: 2 additions & 4 deletions src/app/company/welcome/date-pt.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ export class DatePtPipe implements PipeTransform {
return `${startDay} de ${startMonth}`;
}

const endDate = new Date(start.getTime() + end.getTime());

const endDay = endDate.getDate();
const endMonth = this.translator[endDate.getMonth()];
const endDay = end.getDate();
const endMonth = this.translator[end.getMonth()];

return start.getMonth() === end.getMonth()
? `${startDay} a ${endDay} de ${startMonth}`
Expand Down
2 changes: 1 addition & 1 deletion src/app/deck/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ export class Event {
getDuration(): number {
const beginDate = new Date(this.begin).getTime()
const endDate = new Date(this.end).getTime()
return new Date(endDate - beginDate).getUTCDate() - 1
return new Date(endDate - beginDate).getUTCDate()
}
}

0 comments on commit 0b5abaa

Please sign in to comment.