Use local times for post dates
This commit is contained in:
@@ -10,6 +10,10 @@ module Adamantium
|
||||
published_at.strftime("%e %B, %Y")
|
||||
end
|
||||
|
||||
def machine_published_at
|
||||
published_at.rfc2822
|
||||
end
|
||||
|
||||
def syndicated?
|
||||
!syndication_sources.empty?
|
||||
end
|
||||
|
@@ -22,6 +22,7 @@ html
|
||||
link rel="icon" type="image/x-icon" href="/assets/favicon.ico"
|
||||
|
||||
script data-domain="dnitza.com" src="https://stats.dnitza.com/js/script.js" defer="true"
|
||||
script src="/assets/index.js"
|
||||
|
||||
script src="https://unpkg.com/htmx.org@1.8.4" integrity="sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV" crossorigin="anonymous"
|
||||
|
||||
|
@@ -7,6 +7,7 @@ div class="mb-8"
|
||||
= bookmark.content
|
||||
== render :tags, tags: bookmark.tags
|
||||
|
||||
p class="text-sm u-url text-blue-400 hover:text-blue-600 dark:hover:text-blue-200"
|
||||
p class="text-sm text-blue-400"
|
||||
a href="/bookmark/#{bookmark.slug}"
|
||||
= bookmark.display_published_at
|
||||
time class="dt-published" datetime=bookmark.machine_published_at
|
||||
= bookmark.display_published_at
|
||||
|
@@ -7,5 +7,5 @@ div class="mb-8 h-entry"
|
||||
== render :tags, tags: post.tags
|
||||
|
||||
p class="text-sm text-blue-400"
|
||||
time class="dt-published" datetime=post.published_at
|
||||
time class="dt-published" datetime=post.machine_published_at
|
||||
= post.display_published_at
|
||||
|
9
public/assets/index.js
Normal file
9
public/assets/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
(function() {
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const times = document.querySelectorAll('time');
|
||||
times.forEach((time) => {
|
||||
const oldDtime = Date.parse(time.dateTime);
|
||||
time.innerHTML = new Date(oldDtime).toLocaleDateString(navigator.language, { weekday:"long", year:"numeric", month:"short", day:"numeric"});
|
||||
});
|
||||
});
|
||||
})();
|
Reference in New Issue
Block a user