Skip to content

Commit

Permalink
fix(events): change timezone function
Browse files Browse the repository at this point in the history
  • Loading branch information
oliveirabalsa committed Jul 26, 2023
1 parent b408325 commit 74e83ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/modules/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import 'dayjs/locale/pt-br';

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.locale('pt-br');
dayjs.tz.setDefault('America/Sao_Paulo');

@Injectable()
export class EventService {
Expand Down Expand Up @@ -195,10 +197,10 @@ export class EventService {
},
});

const currentTime = dayjs().tz('America/Sao_Paulo');
const currentTime = dayjs();

return events.map((event) => {
const eventStartDate = dayjs(event.startDate).tz('America/Sao_Paulo');
const eventStartDate = dayjs(event.startDate);
if (dayjs(eventStartDate).isBefore(currentTime)) {
event.status = 'DONE';
}
Expand Down

0 comments on commit 74e83ad

Please sign in to comment.