mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-12-02 10:34:22 +01:00
fix: remove fallback to new Date() for non-timestamp formats in date validation
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -309,12 +309,6 @@ const getStartDate = function (prevTime, dateFormat, str) {
|
|||||||
log.debug('Invalid date:' + str);
|
log.debug('Invalid date:' + str);
|
||||||
log.debug('With date format:' + dateFormat.trim());
|
log.debug('With date format:' + dateFormat.trim());
|
||||||
|
|
||||||
// Only allow fallback to new Date() for timestamp formats (x, X)
|
|
||||||
// For all other formats, if dayjs strict parsing fails, throw an error
|
|
||||||
if (!isTimestampFormat(dateFormat)) {
|
|
||||||
log.debug(`Invalid date: "${str}" does not match format "${dateFormat.trim()}".`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Timestamp formats can fall back to new Date()
|
// Timestamp formats can fall back to new Date()
|
||||||
const d = new Date(str);
|
const d = new Date(str);
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user