Skip to content

Commit

Permalink
use date-fns-tz to set time in Paris, for France Travail broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeBu committed Jul 17, 2024
1 parent 146f53c commit e86f7ed
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
1 change: 1 addition & 0 deletions back/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"body-parser": "^1.20.0",
"bottleneck": "^2.19.5",
"date-fns": "2.28.0",
"date-fns-tz": "^3.1.3",
"dotenv": "^16.0.0",
"express": "^4.19.2",
"express-ipfilter": "^1.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fromZonedTime } from "date-fns-tz";
import subDays from "date-fns/subDays";
import {
AgencyDtoBuilder,
Expand Down Expand Up @@ -399,8 +400,9 @@ function conventionToConventionNotification(
telephone: convention.signatories.beneficiary.phone,
prenom: convention.signatories.beneficiary.firstName,
nom: convention.signatories.beneficiary.lastName,
dateNaissance: new Date(
dateNaissance: fromZonedTime(
`${convention.signatories.beneficiary.birthdate}T00:00:00`,
"Europe/Paris",
).toISOString(),
dateDemande: new Date(convention.dateSubmission).toISOString(),
dateDebut: new Date(convention.dateStart).toISOString(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fromZonedTime } from "date-fns-tz";
import {
ImmersionObjective,
WithConventionDto,
Expand Down Expand Up @@ -71,8 +72,9 @@ export class BroadcastToPoleEmploiOnConventionUpdates extends TransactionalUseCa
telephone: beneficiary.phone,
prenom: beneficiary.firstName,
nom: beneficiary.lastName,
dateNaissance: new Date(
dateNaissance: fromZonedTime(
`${convention.signatories.beneficiary.birthdate}T00:00:00`,
"Europe/Paris",
).toISOString(),
dateDemande: new Date(convention.dateSubmission).toISOString(),
dateDebut: new Date(convention.dateStart).toISOString(),
Expand Down
36 changes: 20 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e86f7ed

Please sign in to comment.