Fuzzy Dates

August 10, 2009 by nuno costa 1 comment

Ext.fc.FuzzyDate

A nice way to present dates

About

The FuzzyDate plugin was inspired by the TimeAgo plugin for jQuery . I needed something similar for ExtJs. Since i didn’t find it I decided to build one for ExtJs.

 

Features

  • Updates timestamps automatically, avoiding timestamps dated "1 minute ago" even though the page was opened 10 minutes ago
  • Multiple languages supported
  • Fully Customizable
  • You can define several date formats, so that fuzzyDate knows how to parse your dates
  • Aplly to an specific element with the applyTo() function or to all elements with the init() or walkDom() function
  • if don’t need automatic updates neither want to have it atached to an element you can simply get the translated date with the translate() function

 

How to use it

Apply to all elements

 

<p>2009 New years eve will be <span title="2009-12-31" class="fuzzyDate">2009-12-31</span></p>
 
<script type="text/javascript">
    Ext.onReady(function(){
        new Ext.fc.fuzzyDate().init();
    });  
</script>

 Apply to a specific element

<p>Chirstmas eve will be <span title="2009-12-24" class="fuzzyDate" id="xmas-eve">2009-12-24</span></p>
 
<script type="text/javascript">
    Ext.onReady(function(){
       var f = new Ext.fc.fuzzyDate();
       f.applyTo('xmas-eve')
    });  
</script>

 Just Get the Translated date

<script type="text/javascript">
    Ext.onReady(function(){
       var f = new Ext.fc.fuzzyDate();
       alert ( f.translate('2009-12-25') );
    });  
</script>

 

 

See it in action

Check out the demo page

 

Download

download-now  

 

1 comment so far Add Your Comment

  1. [...] Since i didn’t find it I decided to build one for ExtJs. Fuzzy Date Extjs Plugin Download  Demo  Tutorial  Posted in ajax | Tags: dates, extjs, fuzzy dates, plugin « jQuery [...]

More from francodacosta.com

© francodacosta.com - All rights reserved