Skip to content

Commit

Permalink
Merge pull request #2272 from bcgov/feat/2216
Browse files Browse the repository at this point in the history
chore: check updated_at validity
  • Loading branch information
junminahn authored Mar 13, 2024
2 parents 1825d6a + e2e3d3e commit d832e95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/api/private-cloud/all-projects/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export async function GET(req: NextRequest) {
secondaryTechnicalLeadEmail: project.secondaryTechnicalLead ? project.secondaryTechnicalLead.email : '',
secondaryTechnicalLeadName: formatFullName(project.secondaryTechnicalLead),
created: formatDate(project.created.$date),
updatedAt: formatDate(project.updatedAt.$date),
updatedAt: formatDate(project.updatedAt?.$date),
licencePlate: project.licencePlate,
status: project.status,
}));
Expand Down
2 changes: 1 addition & 1 deletion app/api/public-cloud/all-projects/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function GET(req: NextRequest) {
secondaryTechnicalLeadEmail: project.secondaryTechnicalLead ? project.secondaryTechnicalLead.email : '',
secondaryTechnicalLeadName: formatFullName(project.secondaryTechnicalLead),
created: formatDate(project.created.$date),
updatedAt: formatDate(project.updatedAt.$date),
updatedAt: formatDate(project.updatedAt?.$date),
licencePlate: project.licencePlate,
status: project.status,
}));
Expand Down
2 changes: 2 additions & 0 deletions utils/date.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const formatDate = (date: string) => {
if (!date) return '';

const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const d = new Date(date);

Expand Down

0 comments on commit d832e95

Please sign in to comment.