https://github.com/msarhan/angular-moment-hijri
Moment.JS directives & filters for AngularJS (timeago alternative) with Hijri calendar system support
https://github.com/msarhan/angular-moment-hijri
Last synced: about 1 year ago
JSON representation
Moment.JS directives & filters for AngularJS (timeago alternative) with Hijri calendar system support
- Host: GitHub
- URL: https://github.com/msarhan/angular-moment-hijri
- Owner: msarhan
- Created: 2015-03-07T00:58:12.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-07-12T12:53:23.000Z (about 9 years ago)
- Last Synced: 2024-11-12T02:35:24.240Z (over 1 year ago)
- Language: JavaScript
- Size: 60.5 KB
- Stars: 4
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
angular-moment-hijri
====================
This is a merge between [@urish](https://github.com/urish)'s [angular-moment](https://github.com/urish/angular-moment) and [xsoh](https://github.com/xsoh)'s [moment-hijri](https://github.com/xsoh/moment-hijri)
[angular-moment](https://github.com/urish/angular-moment) is an AngularJS directives and filters for [Moment.JS](http://www.momentjs.com).
[moment-hijri](https://github.com/xsoh/moment-hijri) is a Hijri (Based on Umm al-Qura calculations) calendar system plugin for [Moment.JS](http://www.momentjs.com).
Installation
------------
* Bower: `bower install angular-moment-hijri --save`
* Download from github: [angular-moment-hijri.min.js](https://raw.github.com/msarhan/angular-moment-hijri/master/angular-moment-hijri.min.js)
Usage
-----
Include both moment.js and angular-moment-hijri.js in your application.
```html
```
Add `angularMomentHijri` as a dependency to your app module:
```js
var myApp = angular.module('myApp', ['angularMomentHijri']);
```
If you need Arabic support, load ar-sa.js locale file first:
```html
```
Then call the `amMoment.changeLocale()` method (e.g. inside your app's run() callback):
```js
myApp.run(function(amMoment) {
amMoment.changeLocale('ar-sa');
});
```
### amDateFormat filter
Format dates using moment.js format() method. Example:
```js
myApp.controller('AppCtrl', function($scope) {
$scope.message = {
time: new Date(2015, 2, 17, 7, 10, 20)
};
});
```
```html
{{message.time | amDateFormat:'dddd, hMMMM hYYYY, hh:mm:ss a'}}
```
This snippet will format the given time as "Tuesday, Jumada al-Ula 1436, 07:10:20 am".
For more information about Moment.JS formatting options, see the
[docs for the format() function](http://momentjs.com/docs/#/displaying/format/).
License
-------
Released under the terms of MIT License.