From 72c7acc9c30606efd0afd64a304acbedf3f7019a Mon Sep 17 00:00:00 2001 From: Carson Full Date: Tue, 17 Dec 2024 17:30:29 -0600 Subject: [PATCH] Fix engagement/pnp date match to exact match days exactly (#3344) --- .../pnp/verifyEngagementDateRangeMatches.ts | 12 ++++-------- .../reextract-all-progress-reports.migration.ts | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/components/pnp/verifyEngagementDateRangeMatches.ts b/src/components/pnp/verifyEngagementDateRangeMatches.ts index a10b075e4a..b9c31821d5 100644 --- a/src/components/pnp/verifyEngagementDateRangeMatches.ts +++ b/src/components/pnp/verifyEngagementDateRangeMatches.ts @@ -1,4 +1,5 @@ import { stripIndent } from 'common-tags'; +import { DateTime } from 'luxon'; import { DateInterval } from '~/common'; import { PnpPlanningExtractionResult, @@ -19,10 +20,7 @@ export function verifyEngagementDateRangeMatches( } const matches = - engagementRange && - pnpRange && - // PnP only specifies months; allow nuance on our side. - engagementRange.expandToFull('month').equals(pnpRange); + engagementRange && pnpRange && engagementRange.equals(pnpRange); if (matches) { return true; @@ -68,13 +66,11 @@ const MismatchedEngagementDateRange = PnpProblemType.register({ message: stripIndent` The PnP's **project dates** (\`${source}\`) are different from what is declared in the CORD Engagement/Project. - CORD: ${eng.toLocaleString({ month: 'long', year: 'numeric' })} - PnP: ${pnp.toLocaleString({ month: 'long', year: 'numeric' })} + CORD: ${eng.toLocaleString(DateTime.DATE_MED)} + PnP: ${pnp.toLocaleString(DateTime.DATE_MED)} Please adjust the dates in CORD or the PnP to match and be accurate. - CORD only requires the month & year to match the PnP since this is as granular as it gets. - If this is a cluster project and this engagement ("language") has started late or ends early, that difference can be declared in CORD's _Engagement dates_. `.replaceAll(/\n/g, ' \n'), // keep line breaks with MD's two space trailers diff --git a/src/components/progress-report/migrations/reextract-all-progress-reports.migration.ts b/src/components/progress-report/migrations/reextract-all-progress-reports.migration.ts index c1d6b4959f..bd383cf307 100644 --- a/src/components/progress-report/migrations/reextract-all-progress-reports.migration.ts +++ b/src/components/progress-report/migrations/reextract-all-progress-reports.migration.ts @@ -8,7 +8,7 @@ import { FileVersion } from '../../file/dto'; import { PeriodicReportUploadedEvent } from '../../periodic-report/events'; import { ProgressReport } from '../dto'; -@Migration('2024-12-16T16:33:00') +@Migration('2024-12-17T16:00:00') export class ReextractPnpProgressReportsMigration extends BaseMigration { constructor( private readonly eventBus: IEventBus,