diff options
author | w-e-w <40751091+w-e-w@users.noreply.github.com> | 2022-10-23 09:17:39 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-24 07:28:42 +0000 |
commit | eb007e5884c23fbc38d7e9d1dd3669625270ca27 (patch) | |
tree | 6e5088d746db070c30f47e0f71d3a08dbae2b3f1 | |
parent | 5a981310e68253c77f9fe3144d247cfd531f9e48 (diff) | |
download | stable-diffusion-webui-gfx803-eb007e5884c23fbc38d7e9d1dd3669625270ca27.tar.gz stable-diffusion-webui-gfx803-eb007e5884c23fbc38d7e9d1dd3669625270ca27.tar.bz2 stable-diffusion-webui-gfx803-eb007e5884c23fbc38d7e9d1dd3669625270ca27.zip |
use the same datetime object for [date] and [datetime]
-rw-r--r-- | modules/images.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/images.py b/modules/images.py index ff00fc52..a9b1330d 100644 --- a/modules/images.py +++ b/modules/images.py @@ -302,8 +302,9 @@ def apply_filename_pattern(x, p, seed, prompt): x = re.sub(r'\[sampler]', sanitize_filename_part(sd_samplers.samplers[p.sampler_index].name, replace_spaces=False), x, flags=re.IGNORECASE)
x = re.sub(r'\[model_hash]', getattr(p, "sd_model_hash", shared.sd_model.sd_model_hash), x, flags=re.IGNORECASE)
- x = re.sub(r'\[date]', datetime.date.today().isoformat(), x, flags=re.IGNORECASE)
- x = replace_datetime(x, datetime.datetime.now())
+ current_time = datetime.datetime.now()
+ x = re.sub(r'\[date]', current_time.strftime('%Y-%m-%d'), x, flags=re.IGNORECASE)
+ x = replace_datetime(x, current_time) # replace [datetime], [datetime<Format>], [datetime<Format><Time Zone>]
x = re.sub(r'\[job_timestamp]', getattr(p, "job_timestamp", shared.state.job_timestamp), x, flags=re.IGNORECASE)
# Apply [prompt] at last. Because it may contain any replacement word.^M
if prompt is not None:
|