mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2025-12-18 21:53:26 +00:00
Prevent the post date from shifting when loading
This commit is contained in:
@@ -10,14 +10,13 @@ $(function() {
|
||||
|
||||
let intervalId = void 0;
|
||||
|
||||
function timeago(iso, preposition) {
|
||||
function timeago(iso) {
|
||||
let now = new Date();
|
||||
let past = new Date(iso);
|
||||
let prep = (typeof preposition !== "undefined" ? `${preposition} ` : "");
|
||||
|
||||
if (past.getFullYear() !== now.getFullYear()) {
|
||||
toRefresh -= 1;
|
||||
return prep + past.toLocaleString("en-US", {
|
||||
return past.toLocaleString("en-US", {
|
||||
year: "numeric",
|
||||
month: "short",
|
||||
day: "numeric"
|
||||
@@ -26,7 +25,7 @@ $(function() {
|
||||
|
||||
if (past.getMonth() !== now.getMonth()) {
|
||||
toRefresh -= 1;
|
||||
return prep + past.toLocaleString("en-US", {
|
||||
return past.toLocaleString("en-US", {
|
||||
month: "short",
|
||||
day: "numeric"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user