First time here? Check out the FAQ!
1

Date abbreviation for 2020 shown as `'0`

The main page summary for posts, and the "info box" that accompanies each post, includes a date abbreviation like: Dec 25 '19

But for posts in 2020, the abbreviation looks like: Apr 22 '0.

Clearly that's a bug — it should read: Apr 22 '20 using the last two digits of the year.

Hopefully an easy one to fix!

dajare's avatar
65
dajare
asked 2020-06-15 06:44:21 -0600, updated 2020-06-26 03:00:45 -0600
edit flag offensive 0 remove flag close merge delete

Comments

1

@Evgeny -- This bug can be observed on Ask Askbot here, and also on Ask Sage. Could not see an issue or a pull request for it in [the askbot-devel issue tracker](https://github.com/ASKBOT/askbot-devel/issues?q=sort%3Aupdated-desc) but it would be nice to fix.

slelievre's avatar slelievre (2020-07-16 04:15:08 -0600) edit
add a comment see more comments

3 Answers

0

Hello, The bug is in the timeago.js file.

The year shall be reset every century not every 20 years.

here is the fix:

$ git diff media/jslib/timeago.js
diff --git a/askbot/media/jslib/timeago.js b/askbot/media/jslib/timeago.js
index 0c20f0242..5f9c8561d 100644
--- a/askbot/media/jslib/timeago.js
+++ b/askbot/media/jslib/timeago.js
@@ -107,7 +107,7 @@
             //how to do this in js???
             return month_date;
         } else {
-            return month_date + ' ' + "'" + date.getYear() % 20;
+            return month_date + ' ' + "'" + date.getYear() % 100;
         }
     } else if (days == 2) {
         return gettext('2 days ago')

I hope it helps

edi31's avatar
1
edi31
answered 2020-07-08 03:40:47 -0600
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
1

This was also reported at various Askbot-powered sites including:

This ended up being reported on the Askbot issue tracker:

and there is now a proposed fix in the form of:

which is waiting to be merged.

slelievre's avatar
196
slelievre
answered 2020-08-14 12:47:54 -0600
edit flag offensive 0 remove flag delete link

Comments

Grateful for your pull-request and hoping this gets rolled out soon!

dajare's avatar dajare (2020-08-14 13:21:53 -0600) edit
add a comment see more comments