1.1.3 • Published 7 years ago

ezdate v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

ezdate: a jQuery plugin

NPM Bower npm Github All Releases

The easiest and the best way to convert dates to persian date.


ezdate is a 1 KB (gzipped, minfied) jquery function that converts dates in your website automatically to persian date.


Usage

First, load jQuery and the plugin:

<script src="jquery.min.js" type="text/javascript"></script>
<script src="jquery.ezdate.js" type="text/javascript"></script>

Now, let's attach it to your timestamps on DOM ready - put this in the head section:

<script type="text/javascript">
   jQuery(document).ready(function() {
     $("time.ezdate").ezdate();
   });
</script>

This will turn all <time> elements with a class of ezdate and a datetime attribute:

<time class="ezdate" datetime="10/18/1993">October 18, 1993</time>

into something like this:

<time class="ezdate" datetime="10/18/1993">26/7/1372</time>

##Options ####persianNumber (default: false)

$("time.ezdate").ezdate({
    persianNumber: true
});

Turns:

<time class="ezdate" datetime="10/18/1993">October 18, 1993</time>

into

<time class="ezdate" datetime="10/18/1993">۲۶/۷/۱۳۷۲</time>

####attrName (default: 'data-datetime') Date source attribute. It's recommended to use data-datetime for ezdate as it's HTML5 friendly too.


####dateFormat (default: D/M/YYYY) You can use your custom date format to show.

Some examples:

ValueMeaning
D/M/YYYY26/7/1372
D/MM/YYYY26/07/1372
DD/MMM/YYYY26/مهر/1372

ezdate also calls complete function when finished its job as callback.

Enjoy using ezdate!

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago