Skip to content
Open
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
12 changes: 12 additions & 0 deletions app/javascript/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ document.addEventListener('turbo:load', (event) => {
timeago.render(timeago_nodes);
}

const localTimeFormatter = new Intl.DateTimeFormat(undefined, {
dateStyle: "medium",
timeStyle: "short",
timeZoneName: "short",
});
document.querySelectorAll('time.local-time').forEach((el) => {
const date = new Date(el.getAttribute('datetime'));
if (!isNaN(date.getTime())) {
el.textContent = localTimeFormatter.format(date);
}
});
Comment on lines +19 to +24

// Copy to clipboard for key installation on servers
const clipboard = new ClipboardJS('.clipboard');
clipboard.on('success', function (e) {
Expand Down
5 changes: 3 additions & 2 deletions app/views/destinations/deploys.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@
</span>
</div>
<div class="is-flex is-align-items-center shipyrd-flex-gap-md">
<time class="is-size-7 has-text-grey" datetime="<%= latest.recorded_at %>">
<%= latest.recorded_at.in_time_zone(latest.application.organization.selected_time_zone).strftime("%Y-%m-%d %I:%M %p") %>
<% recorded_at = latest.recorded_at || latest.created_at %>
<time class="local-time is-size-7 has-text-grey" datetime="<%= recorded_at.iso8601 %>">
<%= recorded_at.in_time_zone(latest.application.organization.selected_time_zone).strftime("%Y-%m-%d %I:%M %p") %>
</time>
<% if latest.compare_url.present? %>
<%= link_to "Compare changes", latest.compare_url, target: "_blank", class: "button is-info is-small has-text-white" %>
Expand Down