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

@ah99/ngx-date-picker

v1.0.2-beta

Published

![Angular Date Picker](https://github.com/amir-rh99/ngx-date-picker/raw/master/src/assets/AngularDatePicker.png)

Downloads

40

Readme

Angular Date Picker

Angular Date Picker

ngx-date-picker is a customizable jalali ( persian ) and gregorian date picker for Angular +12

Check online demo

Install and Setup

step 1: install @ah99/ngx-date-picker

npm i @ah99/ngx-date-picker

step 2: Import NgxDatePickerModule to your module

import { NgxDatePickerModule } from '@ah99/ngx-date-picker'

@NgModule({
    imports: [
        NgxDatePickerModule.forRoot() // dont forget forRoot()
    ]
})

step 3: Import css styles to your global styles ( usually styles/.css/.scss/.less/ )

  @import "@ah99/ngx-date-picker/styles"

Use

use ngx-date-picker directive on any html input element you need

  <input ngx-date-picker [(ngModel)]="dateControl">

important: you need to setup one form model in your input element with formControl or ngModel So you must have already imported FormsModule or ReactiveFormsModule in your module.

Config

There are some options for config your date picker as below:

| Option | Type | Default | Description | ------ | ---- | ------- | ---------- | calendar | "gregorian" | "jalali" | "gregorian" | Type of your calendar | format | ValueFormat | "DD/MM/YYYY" | Format of your input element value | outputData | object | OutputEvent Config | Output values from the onDateSelect event | displayFooter | boolean | true | This option is for date picker action buttons. date picker will be closed immediately after selecting the date if this option set to false. | doneText | string | "Done" | Done action text | cancelText | string | "Cancel" | Done action text | theme | "light" | "dark" | "light | Date picker theme mode | themeConfig | object | Default Theme Config | You can change default styles like Primary-Color in light and dark mode

ValueFormat

"MM/DD/YYYY" | "MM-DD-YYYY" | "DD-MM-YYYY" | "DD/MM/YYYY"

OutputEventConfig

outputData: {
  date: true, // boolean
  type: false, // boolean
  year: false, // boolean
  month: false, // boolean
  day: false // boolean
}

DefaultThemeConfig

themeConfig: {
    light: {
        primaryColor: "#777777", // string
        secondaryColor: "#444444", // string
        backgroudColor: "#ffffff" // string
    },
    dark: {
        primaryColor: "#ffffff", //string
        secondaryColor: "#eeeeee", // string
        backgroudColor: "#444444" // string
    },
    rounded: "medium" // flase | "medium" | "full"
}

How to config?

If you want customize default configs, you can do it in two ways:

1. Global Config

Define your configs inside the NgxDatePickerModule.forRoot() . This configs will be applied to all date pickers.

Example:

NgxDatePickerModule.forRoot({
  calendar: "jalali",
  displayFooter: false,
  theme: "dark",
  themeConfig: {
    rounded: "full",
    dark: {
      primaryColor: "#bbbbbb"
    }
  }
})

All of your configs will be merged with default configs

2. Individual Config

You can set individual configs for every date picker by pass your custom configs to it with datePickerConfig.

Example:

<!-- HTML template -->

<input ngx-date-picker [(ngModel)]="dateControl"
[datePickerConfig]="customConfig">
// typescript component

import { CustomConfig } from '@ah99/ngx-date-picker';
...
customConfig: CustomConfig = {
  calendar: "gregorian",
  format: "DD-MM-YYYY",
  themeConfig: {
    light: {
      primaryColor: "#ca8c07"
    }
  }
}

Your individual configs will be merged with global configs

Output Event (onDateSelect)

This event will be triggered when you select the date. The output value will be an object whose fields you can specify in OutputEvent Config.

Example:

<input ngx-date-picker [(ngModel)]="dateControl"
(onDateSelect)="log($event)">