Keep your résumé dates current automatically with jQuery

You can easily create dynamically updating dates in your pages with jQuery.† I actually use Template Toolkit to keep the dates accurate in my résumé. It’s better to do it that way—build static content based on dynamic information—because the automated web agents that recruiters use are less likely to understand JavaScript. Before discounting that advice know that I’ve had 6 recruiters write me out of the blue this Summer and it wasn’t from my awesome networking abilities.

This is a bit of a puff piece as you’ll have to adapt the code somewhat to use for your own page. Still, this is fun, easy and can be adapted to a number of other applications. Think “member since” or displaying dates and times in the user’s local time instead of your server’s.

Click here to convert dates

Since 2012 · Mayan High Priest.

Since 2009 · Proprietor, Man-Pops, International.

Since 2008 · Merchandising Director of something equally dirty.

Since 2007 · Monkey spanker.

Since 1998 · Proprietor, Sedition·com.

Since like forever · Super Genius.

You’ll have to put your dates into some kind of container to find them easily unless you want to do some monster slow parsing of the text. We went with the class “since” in <b/>s but you can do it however you like for your page. Here is what the above entries look like raw–

<p><b class="since">Since 1998</b> · Proprietor, Sedition·com.</p>

And the code. Note the ternary operator we use to get “1 year” versus “2 years” correct.

The jQuery + helper function

  // Compute thisYear up front.
  var now = new Date;
  var thisYear = now.getFullYear();
  function getYearsEx (year) {
     var diff = thisYear - year;
     if ( ! year || diff < 0 || isNaN(diff) )
         return "No experience";
     else if ( diff == 0 )
         return "Less than a year";
         return diff + " year" +
               ( diff == 1 ? "" : "s" );

                        var year = $(this).text().replace(/\D+/g,"");
                        var yearsEx = getYearsEx(year);

And the TT2 version just for fun–

[% USE date %]
[% this_year = date.format(, '%Y') %]
  [% this_year - 1998 %] years as proprietor of Sedition·com.
  [% this_year - 2007 %] year[% "s" IF this_year > 2008 %] with jQuery
† The big caveat being, your date display is tied to the system clock of the viewer’s computer and browser. Most everyone online has their time set automatically and correctly but you never know what recruiter might see your résumé with a broken Windows installation that chops 5 years off all your experience.
digg stumbleupon reddit Fark Technorati Faves