Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
843caaf01f
commit
27cc78ede5
1 changed files with 11 additions and 6 deletions
|
|
@ -279,22 +279,27 @@ export default {
|
|||
}
|
||||
},
|
||||
formatToYYYYMMDD(dateString) {
|
||||
var returnValue = null;
|
||||
|
||||
try {
|
||||
// Avoid any UTC / local time issues by always treating the input and output as UTC.
|
||||
if (!dateString) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Avoid any UTC / local time issues by always treating the output as UTC.
|
||||
const date = new Date(dateString);
|
||||
if (Number.isNaN(date.getTime())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const year = date.getUTCFullYear();
|
||||
const month = String(date.getUTCMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getUTCDate()).padStart(2, "0");
|
||||
|
||||
returnValue = `${year}-${month}-${day}`;
|
||||
return `${year}-${month}-${day}`;
|
||||
} catch ( error ) {
|
||||
global.$logger.logError(`[Entry Page] Error formatting date string: ${error} - Input: ${dateString}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue