Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/osfexport/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,21 @@ def get_project_data(nodes, **kwargs):
'id': lambda project, **kwargs: project['id'],
'url': lambda project, **kwargs: project['links']['html'],
'description': lambda project, **kwargs: project['attributes']['description'],
# timestamps are rendered as yyyy-mm-dd hour:minute UTC (24hr)
'date_created': lambda project, **kwargs: datetime.datetime.fromisoformat(
project['attributes']['date_created']
).astimezone().strftime('%Y-%m-%d'),
).astimezone(
datetime.timezone.utc
).strftime(
'%Y-%m-%d %H:%M %Z'
),
'date_modified': lambda project, **kwargs: datetime.datetime.fromisoformat(
project['attributes']['date_modified']
).astimezone().strftime('%Y-%m-%d'),
).astimezone(
datetime.timezone.utc
).strftime(
'%Y-%m-%d %H:%M %Z'
),
'public': lambda project, **kwargs: project['attributes']['public'],
'category': get_category,
'tags': get_tags,
Expand Down
4 changes: 3 additions & 1 deletion src/osfexport/formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ class PDF(FPDF):

def __init__(self, url=''):
super().__init__()
self.date_printed = datetime.datetime.now().astimezone()
self.date_printed = datetime.datetime.now(
datetime.timezone.utc
)
self.url = url
# Setup unicode font for use. Can have 4 styles
self.font = 'dejavu-sans'
Expand Down
2 changes: 1 addition & 1 deletion tests/test_clitool.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def test_get_project_data_for_json_mocks(self):
'Expected description Test2 Description, got: ',
projects[1]['description']
)
expected_date = '2000-01-01'
expected_date = '2000-01-01 14:18 UTC'
assert str(
projects[0]['metadata']['date_created']
) == expected_date, (
Expand Down