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!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
dajare's avatar
65
dajare
asked 4 years ago, updated 4 years ago

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 (4 years ago)
see more comments

3 Answers

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
slelievre's avatar
196
slelievre
answered 4 years ago
link

Comments

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

dajare's avatar dajare (4 years ago)
see more comments
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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
edi31's avatar
1
edi31
answered 4 years ago
link

Comments

see more comments