edited notes: more restrictive check

https://github.com/TriliumNext/Trilium/pull/7704#discussion_r2532135841
This commit is contained in:
contributor 2025-11-16 20:22:48 +02:00
parent 0ee7a4e6d3
commit 00770dc45a

View File

@ -182,8 +182,8 @@ export function dateNoteLabelKeywordToDateFilter(dateStr: string): DateFilter {
}
function isValidDatePrefix(dateStr: string): boolean {
// Check if it starts with YYYY format
if (/^\d{4}/.test(dateStr)) {
// Check if it starts with YYYY format and only contains numbers and dashes afterwards
if (/^\d{4}[-\d]*$/.test(dateStr)) {
const year = parseInt(dateStr.substring(0, 4));
return !isNaN(year) && year > 0 && year < 10000;
}