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 🙏

© 2025 – Pkg Stats / Ryan Hefner

hijri-gregorian

v1.0.4

Published

Angular Standalone Date Picker supporting both Gregorian and Hijri calendars

Readme

HijriGregorianDatePicker

This library was generated with Angular CLI version 17.3.0.

An Angular standalone date picker that supports both Gregorian and Hijri calendars.
Available as an installable package and works with template-driven or reactive forms seamlessly.

✨ Features

  • Dual calendar support (Gregorian & Hijri)
  • Emits selected date in both formats
  • Minimum & maximum date restrictions
  • Works in standalone usage or with reactive forms
  • readOnly input for non-editable mode
  • isHijri input to start in Hijri mode
  • returnedValue input to decide which calendar value updates the form

📦 Installation

Install dependencies:

npm install hijri-gregorian @ng-bootstrap/ng-bootstrap@16 bootstrap@5

Include Bootstrap styles

You can include Bootstrap in two ways:

Option 1 – SCSS (recommended if you want to customize variables)

/* src/styles.scss */
@import "bootstrap/scss/bootstrap";

Angular automatically resolves node_modules paths, so you don’t need ../node_modules/....

Option 2 – CSS (simpler, no SCSS customization)

In angular.json:

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/styles.scss"
],
"scripts": [
  "node_modules/@popperjs/core/dist/umd/popper.min.js",
  "node_modules/bootstrap/dist/js/bootstrap.min.js"
]

Import in your standalone component or module

import { HijriGregorianDatePicker } from 'hijri-gregorian';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [ReactiveFormsModule, HijriGregorianDatePicker],
  templateUrl: './app.component.html',
})
export class AppComponent {}

🔹 1. Standalone Usage

<div class="container mt-5">
  <div class="row">
    <div class="col-md-5">
      <hijri-gregorian
        (dateSelected)="onDatePicked($event)"
        [currentDate]="currentDate"
        [readOnly]="true"
        [isHijri]="true"
        [minDate]="minDate"
        [maxDate]="maxDate"
      />
    </div>

    <div class="col-md-3">
      <span>{{date?.gregorian}}</span><br>
      <span>{{date?.hijri}}</span>
    </div>
  </div>
</div>

Inputs

| Input | Type | Default | Description | | ------------- | --------- | ------- | ----------------------------------------------------- | | currentDate | string | — | Initial date (Format: YYYY-M-D, e.g., 2025-01-01) | | minDate | string | — | Minimum selectable date (Format: YYYY-MM-DD) | | maxDate | string | — | Maximum selectable date (Format: YYYY-MM-DD) | | readOnly | boolean | false | Makes input non-editable if true | | isHijri | boolean | false | Starts calendar in Hijri mode if true | | returnedValue | string | gregorian | Which date value updates the form ('gregorian' or 'hijri') |


Outputs

| Event | Payload | Description | | -------------- | ----------------------------------------------------- | -------------------------------------------------------- | | dateSelected | { gregorian: string, hijri: string, value: string } | Emits selected date in both Gregorian and Hijri formats. |


🔹 2. Reactive Forms Usage

<form class="container mt-5" [formGroup]="form" (ngSubmit)="submit()">
  <div class="row">
    <div class="col-md-5">
      <hijri-gregorian
        formControlName="date"
        returnedValue="gregorian"
      />
    </div>
  </div>

  <button type="submit">Submit</button>
</form>

Component TS

this.form = this.fb.group({
  // With min/max date and disabled
  date: [{ value: '2025-09-21', minDate: '2025-09-19', maxDate: '2025-09-25', disabled: false }, [Validators.required]],

  // Or simple date without min/max or disabled
  // date: ['2025-09-21', [Validators.required]]
});

Notes

  • returnedValue determines which date is written to the form ('gregorian' or 'hijri').
  • Validators like Validators.required can be used.
  • minDate and maxDate can be passed via form control object or as component inputs.
  • readOnly will make the input non-editable even in reactive forms.
  • isHijri starts the calendar in Hijri mode.

Example dateSelected payload

{
  "gregorian": "2025-09-21",
  "hijri": "1446-03-10",
  "value": "2025-09-21"
}

Customization

  • Style using CSS.
  • Adjust date formats or localization as needed.

Known Issues

  • Ensure hijri-converter is installed to avoid conversion errors.
  • Browser support depends on Angular and ng-bootstrap.