Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sky93/ezdate

The easiest way to convert dates to persian date.
https://github.com/sky93/ezdate

convert-dates date jquery jquery-plugin plugin

Last synced: 14 days ago
JSON representation

The easiest way to convert dates to persian date.

Awesome Lists containing this project

README

        

# ezdate: a jQuery plugin
[![NPM](https://img.shields.io/npm/v/ezdate.svg)](https://www.npmjs.com/package/ezdate)
[![Bower](https://img.shields.io/bower/v/ezdate.svg)](http://bower.io/search/?q=ezdate)
[![npm](https://img.shields.io/npm/l/ezdate.svg)](https://github.com/sky93/ezdate/blob/master/License.md)
[![Github All Releases](https://img.shields.io/npm/dt/ezdate.svg)](https://github.com/sky93/ezdate)

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:

```html

```

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

```html

jQuery(document).ready(function() {
$("time.ezdate").ezdate();
});

```

This will turn all `

```html

```

into something like this:

```html

```

##Options
####`persianNumber` (_default: `false`_)

```javascript
$("time.ezdate").ezdate({
persianNumber: true
});
````
Turns:
```html

```
into
```html

```

---
####`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!