Skip to content

Instantly share code, notes, and snippets.

@maban
Last active August 29, 2015 14:03
Show Gist options
  • Select an option

  • Save maban/aeebc9670cfa2b3f14a8 to your computer and use it in GitHub Desktop.

Select an option

Save maban/aeebc9670cfa2b3f14a8 to your computer and use it in GitHub Desktop.

Revisions

  1. maban revised this gist Jul 3, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Thanks and @alfraser86 @gestchild for help with this.
  2. maban revised this gist Jul 3, 2014. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
    File renamed without changes.
  3. maban created this gist Jul 3, 2014.
    3 changes: 3 additions & 0 deletions jsbin.hevucaqu.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    .expired {
    color: red;
    }
    5 changes: 5 additions & 0 deletions jsbin.hevucaqu.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>

    <time class="expiration-date" datetime="2012-06-27">27-06-2012</time>

    <time class="expiration-date" datetime="2015-06-27">27-06-2025</time>
    9 changes: 9 additions & 0 deletions jsbin.hevucaqu.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    var now = new Date();
    $('.expiration-date').each(function() {
    if (now < new Date($(this).attr('datetime'))) {
    $(this).addClass('unexpired');
    }
    else {
    $(this).addClass('expired');
    }
    });