Ask Your Question
1

Date abbreviation for 2020 shown as `'0`

asked 2020-06-15 06:44:21 -0500

dajare's avatar

updated 2020-06-26 03:00:45 -0500

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!

edit retag flag offensive 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 -0500 )edit

3 Answers

Sort by » oldest newest most voted
1

answered 2020-08-14 12:47:54 -0500

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.

edit flag offensive delete link more

Comments

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

dajare's avatar dajare  ( 2020-08-14 13:21:53 -0500 )edit
0

answered 2020-07-08 03:40:47 -0500

edi31's avatar

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-06-15 06:44:21 -0500

Seen: 14,087 times

Last updated: Aug 14 '20