Skip to content

Commit

Permalink
Format timestamp string differently on windows
Browse files Browse the repository at this point in the history
The minus (-) modifiers are not supported
  • Loading branch information
joelostblom committed Nov 29, 2024
1 parent 6278bd4 commit 0363733
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Version number is based on [Semver](https://semver.org/).
Note that major version zero (0.y.z) is for initial development and anything may change at any time.

## [0.8.1] 2024-11-28

## Fixed

- Windows-specific error with format string for timestamps

## [0.8.0] 2024-11-19

## Added
Expand Down
4 changes: 3 additions & 1 deletion canvascli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import getpass
import json
import os
import platform
import re
from collections import defaultdict
from datetime import datetime
Expand Down Expand Up @@ -770,7 +771,8 @@ def save_prepared_grades_to_file(self):
writer.sheets['Sheet1'].write(0, 0, "Record Name:")
writer.sheets['Sheet1'].write(0, 1, "Course Registrations")
writer.sheets['Sheet1'].write(1, 0, "Exported On:")
writer.sheets['Sheet1'].write(1, 1, pd.Timestamp.now().strftime('%b %-d, %Y %-I:%-M %p'))
time_format = '%b %#d, %Y %#I:%#M %p' if platform.system() == 'Windows' else '%b %-d, %Y %-I:%-M %p'
writer.sheets['Sheet1'].write(1, 1, pd.Timestamp.now().strftime(time_format))
click.secho(f'Grades saved to {excel_file_name}.', bold=True, fg='green')
return

Expand Down

0 comments on commit 0363733

Please sign in to comment.