npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-angular-material-hijri-adapter

v1.0.9

Published

This library is an Angular material date adapter for Hijri Calendar Dates and Dates/Time depending on moment-hijri plugin and @angular/material.

Downloads

1,139

Readme

NgxAngularMaterialHijriAdapter

This library is an Angular material date adapter for Hijri Calendar Dates and Dates/Time, it's depending on moment-hijri (v2.1.2) plugin and @angular/material (v13.0.2).

This library was generated with Angular CLI version 13.0.0.

Installation

To use the library you must run npm install ngx-angular-material-hijri-adapter.

Note: Please remember to install the @angular/material and moment-hijri libraries if not exist in your package.json.

@angular/material

You can run: ng add @angular/material

or simply run: npm install @angular/material

or visit: [Angular Material official website](https://material.angular.io/)

moment-hijri

You can run: npm install moment-hijri

or visit: [Moment Hijri Library](https://github.com/xsoh/moment-hijri)

After installation

import { NgxAngularMaterialHijriAdapterModule } from 'ngx-angular-material-hijri-adapter';

@NgModule({
  imports: [
    NgxAngularMaterialHijriAdapterModule
  ],
})
export class AppModule {}

Note: import NgxAngularMaterialHijriAdapterModule module into your root Module -App or Core module- and must be before MatMomentDateModule if it existed.

Localization & Formatting

If you want to apply the hijri adapter and change the formatting or localization for your component or module?

import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core';

import { NgxAngularMaterialHijriAdapterService, DateLocaleKeys, MOMENT_HIJRI_DATE_FORMATS } from 'ngx-angular-material-hijri-adapter';

providers: [
    {
      provide: DateAdapter,
      useClass: NgxAngularMaterialHijriAdapterService,
    },
    // Change the format by using `MOMENT_HIJRI_DATE_FORMATS` for Dates and `MOMENT_HIJRI_DATE_TIME_FORMATS` for date/time.
    { provide: MAT_DATE_FORMATS, useValue: MOMENT_HIJRI_DATE_FORMATS },
    // Change the localization to arabic by using `AR_SA` not `AR` only and `EN_US` not `EN` only.
    { provide: MAT_DATE_LOCALE, useValue: DateLocaleKeys.AR_SA },
],

You can also inject the NgxAngularMaterialHijriAdapterService in the component constructor as following.

constructor(
    private dateAdapter: DateAdapter<any>,
    private hijriDateAdapter: NgxAngularMaterialHijriAdapterService,
  ) {}

ngOnInit() {
  this.dateAdapter?.setLocale(lang);
  this.hijriDateAdapter?.setLocale(lang === DateLocaleKeys.AR ? DateLocaleKeys.AR_SA : DateLocaleKeys.EN_US);
}

Running unit tests

Run ng test ngx-angular-material-hijri-adapter to execute the unit tests via Karma.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI Overview and Command Reference page.

You can ask for help by emailing me at: [email protected]

Thanks for using my library and I wish you the best.