From 4ec2a448ab1938aa3d7a2795760456a42da41453 Mon Sep 17 00:00:00 2001 From: Will Miao <13051207myq@gmail.com> Date: Tue, 15 Apr 2025 10:46:57 +0800 Subject: [PATCH] feat: Improve date formatting in filename generation with zero-padding and two-digit year support. Fixes https://github.com/willmiao/ComfyUI-Lora-Manager/issues/102 --- py/nodes/save_image.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/py/nodes/save_image.py b/py/nodes/save_image.py index d8707611..31c6695e 100644 --- a/py/nodes/save_image.py +++ b/py/nodes/save_image.py @@ -224,12 +224,13 @@ class SaveImage: from datetime import datetime now = datetime.now() date_table = { - "yyyy": str(now.year), - "MM": str(now.month).zfill(2), - "dd": str(now.day).zfill(2), - "hh": str(now.hour).zfill(2), - "mm": str(now.minute).zfill(2), - "ss": str(now.second).zfill(2), + "yyyy": f"{now.year:04d}", + "yy": f"{now.year % 100:02d}", + "MM": f"{now.month:02d}", + "dd": f"{now.day:02d}", + "hh": f"{now.hour:02d}", + "mm": f"{now.minute:02d}", + "ss": f"{now.second:02d}", } if len(parts) >= 2: date_format = parts[1]