| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b22f05a commit 8f29d9d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -202,9 +202,10 @@ def _wrap_strftime(object, format, timetuple): | |||
| 202 | 202 | # Don't call utcoffset() or tzname() unless actually needed. | |
| 203 | 203 | freplace = None # the string to use for %f | |
| 204 | 204 | zreplace = None # the string to use for %z | |
| 205 | + colonzreplace = None # the string to use for %:z | ||
| 205 | 206 | Zreplace = None # the string to use for %Z | |
| 206 | 207 | ||
| 207 | - # Scan format for %z and %Z escapes, replacing as needed. | ||
| 208 | + # Scan format for %z, %:z and %Z escapes, replacing as needed. | ||
| 208 | 209 | newformat = [] | |
| 209 | 210 | push = newformat.append | |
| 210 | 211 | i, n = 0, len(format) | |
@@ -228,6 +229,22 @@ def _wrap_strftime(object, format, timetuple): | |||
| 228 | 229 | zreplace = "" | |
| 229 | 230 | assert '%' not in zreplace | |
| 230 | 231 | newformat.append(zreplace) | |
| 232 | + elif ch == ':': | ||
| 233 | + if i < n: | ||
| 234 | + ch2 = format[i] | ||
| 235 | + i += 1 | ||
| 236 | + if ch2 == 'z': | ||
| 237 | + if colonzreplace is None: | ||
| 238 | + if hasattr(object, "utcoffset"): | ||
| 239 | + colonzreplace = _format_offset(object.utcoffset(), sep=":") | ||
| 240 | + else: | ||
| 241 | + colonzreplace = "" | ||
| 242 | + assert '%' not in colonzreplace | ||
| 243 | + newformat.append(colonzreplace) | ||
| 244 | + else: | ||
| 245 | + push('%') | ||
| 246 | + push(ch) | ||
| 247 | + push(ch2) | ||
| 231 | 248 | elif ch == 'Z': | |
| 232 | 249 | if Zreplace is None: | |
| 233 | 250 | Zreplace = "" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments