Nutritious Pancake Mountain

    ezdate

    1.1.3 • Public • Published

    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:

    Value Meaning
    D/M/YYYY 26/7/1372
    D/MM/YYYY 26/07/1372
    DD/MMM/YYYY 26/مهر/1372

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

    Enjoy using ezdate!

    Install

    npm i ezdate

    DownloadsWeekly Downloads

    3

    Version

    1.1.3

    License

    MIT

    Last publish

    Collaborators

    • sky93