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-hijri-gregorian-datepicker

v1.1.0

Published

* Lightweight **Angular** datepicker based on [ng-bootstrap](https://ng-bootstrap.github.io/#/components/datepicker/overview) that supports **Gregorian** and **Hijri** calendars. * Provides ability to swap between **Gregorian** and **Hijri** calendars

Downloads

1,157

Readme

Hijri Gregorian Datepicker

  • Lightweight Angular datepicker based on ng-bootstrap that supports Gregorian and Hijri calendars.
  • Provides ability to swap between Gregorian and Hijri calendars
  • Converting selected date back and forth when changing calendar type.
  • Provides service DateFormatterService to help converting date formats in both calendars types.
  • It is developed using Angular >=7.0.0 and its newly introduced ng g library schematics.
  • This project was generated with Angular CLI version 7.3.9.

Examples/Demo

Online demo can be found here

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Features

  • Easy to switch between Gregorian and Hijri calendars.
  • Ability to specify the default calendar type either Gregorian or Hijri.
  • Converting dates when changing type of calendar.
  • Ability to specify min and max value for Gregorian and Hijri.
  • Ability to make it required , readonly or disabled.

Installation

npm i ngx-hijri-gregorian-datepicker

API

import { NgxHijriGregorianDatepickerModule } from 'ngx-hijri-gregorian-datepicker';

@Inputs()

| Input| Type| Required| Description | |--|--|--| -- | |selectedDateType|DateType|No| Default calendar type , will be hijri if not sepcified. | |selectedDate|NgbDateStruct|No| Date to bind (two way binding). | |label|string|Yes| Label will be shown besides the input. | |readonly|bool|No| Specify if user can write in input manually without selecting from datepicker. | |isRequired|bool|No| Specify required or not field. | |disabled|bool|No| Specify disabled or not. | |minHijri|NgbDateStruct|No| Minimum allowed hijri date to select. | |maxHijri|NgbDateStruct|No| Maximum allowed hijri date to select. | |minGreg|NgbDateStruct|No| Minimum allowed Gregorian date to select. | |maxGreg|NgbDateStruct|No| Maximum allowed Gregorian date to select. | |hijriLabel|string|No| Label for Hijri button , will be 'Hijri' By Default. | |GregLabel|string|No| Label for Gregorian button , will be 'Gregorian' By Default. |

@Outputs()

| Output| Type| Required| Description | |--|--|--| -- | |selectedDateChange|EventEmitter of NgbDateStruct |--| Emitted after selecting date from picker. |

Dependencies

Make sure that @ng-bootstrap/ng-bootstrap and bootstrap with appropriate versions to angular 7.

Usage

  1. Install the package npm i ngx-hijri-gregorian-datepicker .
  2. Import the NgxHijriGregorianDatepickerModule in your app module import { NgxHijriGregorianDatepickerModule } from 'ngx-hijri-gregorian-datepicker';
  3. In template
<hijri-gregorian-datepicker
   		[label]="'Birth Date'"
   		[(selectedDate)]="selectedDate"
   		[isRequired]="true"
   		[GregLabel]="'Gregorian'"
   		[hijriLabel]  ="'Hijri'"
   		[selectedDateType]="selectedDateType"
   		#datePicker>
</hijri-gregorian-datepicker>`
  1. In typescript file
import { NgbDate } from '@ng-bootstrap/ng-bootstrap';
import { DateType } from 'ngx-hijri-gregorian-datepicker';  

@Component({...})

export  class  AppComponent  {

date:  NgbDate;
selectedDateType  =  DateType.Hijri;  // or DateType.Gregorian

constructor()  {}

}

Utilities

DateFormatterService

| Method| Parameter | Return| Description | |--|--|--| -- | |ToGregorianDateStruct()|gregorianDate: string, format:string|NgbDate|Convert string gregorian date to date struct. | |ToHijriDateStruct()|hijriDate:string, format:string|NgbDate| Convert string hijri date to date struct. | |ToHijri(date)|NgbDateStruct|NgbDateStruct| Convert Gregorian date struct to Hijri struct. | |ToGregorian(date)|NgbDateStruct|NgbDateStruct|Convert Hijri date struct to Gregorian struct.| |ToString(date)|NgbDateStruct|string|Convert date struct to string dd/mm/yyyy| |GetTodayHijri()|--|NgbDateStruct|Get Today's date as hijri.| |GetTodayGregorian()|--|NgbDateStruct|Get Today's date as gregorian.|

Credits

This project is based on ng-bootstrap , moment , moment Hijri .