Skip to content

Commit d6455c1

Browse files
committed
python: add default format for !d conversion specifier
Problem: The `!d` conversion specifier returns an empty string if no format is provided, which could cause confusion in casual usage. For example `{expiration!d}` returns an empty string even if there is an expiration timestamp for a job. If no format is provided, default to an ISO 8601 format "%FT%T".
1 parent 2355579 commit d6455c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bindings/python/flux/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def __format__(self, fmt):
318318
result = ""
319319
else:
320320
# Call strftime() to get the formatted datetime as a string
321-
result = self.strftime(timefmt)
321+
result = self.strftime(timefmt or "%FT%T")
322322

323323
spec = spec[0] if spec else ""
324324

0 commit comments

Comments
 (0)