Skip to content

Commit

Permalink
doc: updated comments in cell-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
MacQSL committed Jan 20, 2025
1 parent 42c7428 commit 8215506
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/src/utils/xlsx-utils/cell-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export function replaceCellDates(cell: CellObject): CellObject {
else if (cell.z !== CUSTOM_XLSX_DATE_FORMAT && isStringCell(cell)) {
const date = formatDateCellValue(cell.v);

// If the string is a date, update the cell value to the formatted date string
if (date) {
return { ...cell, z: DefaultDateFormat, v: date };
}
Expand Down Expand Up @@ -104,8 +105,10 @@ export function formatDateCellValue(cellValue: CellValue): string | null {
return null;
}

// Grab the year from the date string
const dateYear = Number(dateParts[0].length === 4 ? dateParts[0] : dateParts[2]);

// Always prioritize Canadian date formats over American date formats
if (canadianDate.year() === dateYear) {
return canadianDate.format(DefaultDateFormat);
}
Expand Down

0 comments on commit 8215506

Please sign in to comment.