Created
February 27, 2013 10:22
-
-
Save tomviner/5046919 to your computer and use it in GitHub Desktop.
The next Redmine update: keep relative times up-to-date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// locate and parse all relative time links on the page | |
var reDate = /(\d+)\/(\d+)\/(\d+)/; | |
jQuery('a[title]').map(function(){ | |
var a = jQuery(this); | |
if ((a.text() && a.text().length===0) || !a.attr('title').match(reDate) ){return 0} | |
var d = new Date(a.attr('title').replace(reDate, "$3/$2/$1")); | |
return 'make_relative('+d+')'; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment