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

b5k-datepicker

v9.0.2

Published

Angular datepicker

Downloads

10

Readme

B5kDatepicker

This project was generated with Angular CLI version 8.3.21.

Based on project https://github.com/tomblachut/skimmed-datepicker

Demo

https://stackblitz.com/edit/b5k-datepicker

Screenshots

Inline mode

inline mode

Popup mode

popup mode

Features

  • select only years, months or day
  • popover or inline mode
  • ngModel binding
  • reactive forms

Install

npm i b5k-datepicker --save

Import module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';

import { B5kDatepickerModule } from 'b5k-datepicker';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    FormsModule,
    B5kDatepickerModule.forRoot(),
    BrowserAnimationsModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Usage

<input type="text" b5kDatepicker>

Get selected date

  • from event

    <input type="text" b5kDatepicker (dateChange)="dateChangeEvent($event)">

  • ngModel

    <input type="text" b5kDatepicker [(ngModel)]="dateModel">

  • reactive Forms

    <input type="text" b5kDatepicker inlineMode=true formControlName="date">

Localization

Datepicker localization is based on date-fns. Just import lang file into module.

Default language is english enGB, so you don't have to import that language file.

import { pl } from 'date-fns/locale';
import { B5kDatepickerModule, B5kDatepickerConfigService } from 'b5k-datepicker';


const DatepickerConfig = new B5kDatepickerConfigService();
DatepickerConfig.setLocale(pl);

@NgModule({
  ...
  providers: [
    {
      provide: B5kDatepickerConfigService,
      useValue: DatepickerConfig
    }
  ]
})
export class AppModule { }

Options

<input type="text" b5kDatepicker [(ngModel)]="monthModel" [view]="view" [modelFormatter]="monthModelFormatter" [selectOnlyMonths]=true>

| Property | Type | Default | Description | |------------------|--------------|---------|----------------------------------------------------------------------------------------------| | date | Date | -- | Initial date | | inlineMode | boolean | false | Always visible | | inputValueFormatter | function | -- | Function you can format date that is set to input value. | | dayFormat | string | d | Day format in day view, https://date-fns.org/v2.10.0/docs/format | |monthFormat | string | LLL | Format month names in month view. | |headingFormat | string | LLLL y | Format date in month heading, eg. February 2020. |weekStart|WeekDay|WeekDay.Monday| import { WeekDay } from '@angular/common'; |view|ViewMode|ViewMode.Days|import { ViewMode } from './view-mode';| |selectOnlyMonths|boolean|false| If selectOnlyMonths = true and view = ViewMode.Months, you can only select month.| |selectOnlyYears|boolean|false| If selectOnlyYears = true and view = ViewMode.Years you can only select years.|

Events

<input type="text" b5kDatepicker [(ngModel)]="model" (dateChange)="selectedDate($event)">

| Property | Type | Description | |------------------|---------------|-------------| | dateChange | Date | Emitted event when date are selected. |

Todo

  • disable date/dates/date ranges/weekends/weekdays
  • date range selection

Development

Build library and watch for changes ng build b5k-datepicker --watch

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.

Build

npm run release && npm run publish

If you want to change only major, minor or patch.

npm run standard-version -- --release-as minor && npm run build && npm run publish

License

MIT