Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ISO to UTC for Date/Time in workflow reports #16758

Merged
merged 9 commits into from
Oct 20, 2023
2 changes: 1 addition & 1 deletion client/src/components/Markdown/Elements/InvocationTime.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
computed: {
content() {
const invocation = this.invocations[this.args.invocation_id];
return invocation && invocation["create_time"];
return invocation && new Date(invocation["create_time"]).toUTCString();
},
},
};
Expand Down
6 changes: 4 additions & 2 deletions lib/galaxy/managers/markdown_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ def handle_generate_time(self, line, generate_time):
pass

def handle_invocation_time(self, line, invocation):
self.ensure_rendering_data_for("invocations", invocation)["create_time"] = invocation.create_time.isoformat()
self.ensure_rendering_data_for("invocations", invocation)["create_time"] = invocation.create_time.strftime(
"%m/%d/%Y, %H:%M:%S"
assuntad23 marked this conversation as resolved.
Show resolved Hide resolved
)

def handle_dataset_type(self, line, hda):
self.extend_history_dataset_rendering_data(hda, "ext", hda.ext, "*Unknown dataset type*")
Expand Down Expand Up @@ -547,7 +549,7 @@ def handle_generate_time(self, line, generate_time):
return (content, True)

def handle_invocation_time(self, line, invocation):
content = literal_via_fence(invocation.create_time.isoformat())
content = literal_via_fence(invocation.create_time.strftime("%m/%d/%Y, %H:%M:%S"))
return (content, True)

def handle_dataset_name(self, line, hda):
Expand Down
7 changes: 5 additions & 2 deletions test/unit/app/managers/test_markdown_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@ def test_generate_invocation_time(self):
invocation = self._new_invocation()
self.app.workflow_manager.get_invocation.side_effect = [invocation] # type: ignore[attr-defined,union-attr]
result = self._to_basic(example)
assert f"\n {invocation.create_time.isoformat()}" in result
expectedtime = invocation.create_time.strftime("%m/%d/%Y, %H:%M:%S")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the iso date format ( [YYYY]-[MM]-[DD]) ?

assuntad23 marked this conversation as resolved.
Show resolved Hide resolved
assert f"\n {expectedtime}" in result

def test_job_parameters(self):
job = model.Job()
Expand Down Expand Up @@ -412,7 +413,9 @@ def test_get_invocation_time(self):
result, extra_data = self._ready_export(example)
assert "invocations" in extra_data
assert "create_time" in extra_data["invocations"]["be8be0fd2ce547f6"]
assert extra_data["invocations"]["be8be0fd2ce547f6"]["create_time"] == invocation.create_time.isoformat()
assert extra_data["invocations"]["be8be0fd2ce547f6"]["create_time"] == invocation.create_time.strftime(
"%m/%d/%Y, %H:%M:%S"
)

def _ready_export(self, example):
return ready_galaxy_markdown_for_export(self.trans, example)
Loading