From 38666b933ab25d81967aeb40feaab2641206bea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 25 Feb 2026 15:36:29 +0100 Subject: [PATCH 1/2] feat(Get-Notes): allow dynamic filtering based on DaysAgo parameter --- public/getNotes.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/getNotes.ps1 b/public/getNotes.ps1 index 60bf492..1d7fba1 100644 --- a/public/getNotes.ps1 +++ b/public/getNotes.ps1 @@ -21,14 +21,17 @@ function Get-Notes () { [Alias("notes")] param( [Parameter()][string] $Filter, + [Parameter()][int32] $DaysAgo, #all [Parameter()][switch] $All ) + $DaysAgo = $DaysAgo -eq 0 ? 15 : $DaysAgo + $notes = GetNotes -Filter $filter # Filter out files that are older than 30 days - $ret = $All ? $notes : ($notes | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-30) }) + $ret = $All ? $notes : ($notes | Where-Object { $_.LastWriteTime -gt (Get-Date).AddDays(-$DaysAgo) }) # Create a custom object with required properties $ret = $ret | ForEach-Object { @@ -74,7 +77,8 @@ function GetNotesCategory { ) process{ - (($Path | Split-Path -Leaf) -split '-|\.')[1] + $ret = (($Path | Split-Path -Leaf) -split '-|\.')[1] + return $ret } From e61887f3d5f95620d2ae463fca98cfbc18c1a17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 25 Feb 2026 15:36:33 +0100 Subject: [PATCH 2/2] fix(New-Note): validate date input and provide error message if empty --- public/newNotes.ps1 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/public/newNotes.ps1 b/public/newNotes.ps1 index 09a7b16..10ad17d 100644 --- a/public/newNotes.ps1 +++ b/public/newNotes.ps1 @@ -38,6 +38,11 @@ function New-Note{ $Date = Get-Date -Format "yyMMdd" } + if([string]::IsNullOrWhiteSpace($Date)) { + Write-Error "Date is empty. Consider using -DateToday or -Date to specify a date for the note." + return + } + $fileName = getFileName -Category $Category -Section $Section -Title $Title -Date $Date # Create the note base folder