Format a date32 value.
(val)
| 267 | |
| 268 | |
| 269 | def format_date32(val): |
| 270 | """ |
| 271 | Format a date32 value. |
| 272 | """ |
| 273 | val = int(val) |
| 274 | try: |
| 275 | decoded = datetime.date.fromordinal(val + _date_base) |
| 276 | except ValueError: # "ordinal must be >= 1" |
| 277 | return f"{val}d [year <= 0]" |
| 278 | else: |
| 279 | return f"{val}d [{decoded}]" |
| 280 | |
| 281 | |
| 282 | def format_date64(val): |