1.0.0 • Published 6 years ago

angular-moment-hijri v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

angular-moment-hijri

This is a merge between @urish's angular-moment and xsoh's moment-hijri

angular-moment is an AngularJS directives and filters for Moment.JS.

moment-hijri is a Hijri (Based on Umm al-Qura calculations) calendar system plugin for Moment.JS.

Installation

Usage

Include both moment.js and angular-moment-hijri.js in your application.

<script src="components/moment/moment.js"></script>
<script src="components/angular-moment-hijri/angular-moment-hijri.js"></script>

Add angularMomentHijri as a dependency to your app module:

var myApp = angular.module('myApp', ['angularMomentHijri']);

If you need Arabic support, load ar-sa.js locale file first:

<script src="components/moment/locale/ar-sa.js"></script>

Then call the amMoment.changeLocale() method (e.g. inside your app's run() callback):

myApp.run(function(amMoment) {
	amMoment.changeLocale('ar-sa');
});

amDateFormat filter

Format dates using moment.js format() method. Example:

myApp.controller('AppCtrl', function($scope) {
	$scope.message = {
		time: new Date(2015, 2, 17, 7, 10, 20)
	};
});
<span>{{message.time | amDateFormat:'dddd, hMMMM hYYYY, hh:mm:ss a'}}</span>

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.

License

Released under the terms of MIT License.