mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 22:44:25 +01:00
edited notes: more restrictive check
https://github.com/TriliumNext/Trilium/pull/7704#discussion_r2532135841
This commit is contained in:
parent
0ee7a4e6d3
commit
00770dc45a
@ -182,8 +182,8 @@ export function dateNoteLabelKeywordToDateFilter(dateStr: string): DateFilter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isValidDatePrefix(dateStr: string): boolean {
|
function isValidDatePrefix(dateStr: string): boolean {
|
||||||
// Check if it starts with YYYY format
|
// Check if it starts with YYYY format and only contains numbers and dashes afterwards
|
||||||
if (/^\d{4}/.test(dateStr)) {
|
if (/^\d{4}[-\d]*$/.test(dateStr)) {
|
||||||
const year = parseInt(dateStr.substring(0, 4));
|
const year = parseInt(dateStr.substring(0, 4));
|
||||||
return !isNaN(year) && year > 0 && year < 10000;
|
return !isNaN(year) && year > 0 && year < 10000;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user