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

@kokotree-inc/ng-bootstrap-date-range-picker

v1.2.5

Published

Angular library for displaying a customizable date range picker with support for presets, date ranges, and calendar views using the ng-bootstrap library.

Downloads

89

Readme

Preview

Preview Image

Installation

$ npm i @kokotree-inc/ng-bootstrap-date-range-picker

Usage

  1. Import the DateRangePickerModule module in your app module or page module:

    
        import { DateRangePickerUtils, DateRangePickerModule } from '@kokotree-inc/ng-bootstrap-date-range-picker';
        import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
    
        @NgModule({
            declarations: [....],
            imports: [...., DateRangePickerModule, NgbModule],
            providers: [DateRangePickerUtils],
            bootstrap: [....]
        })
        export class AppModule {}

Also add the DateRangePickerUtils provider to your app module or page module providers.

  1. Include the DateRangePickerComponent in your page template HTML:

    <app-date-range-picker [dateRangeKey]="dateRangeKey" (rangeChanged)="onRangeChanged($event)"> </app-date-range-picker>
  2. In your page script, define the onRangeChanged function to receive the date range selection changes:

    import { DateRangeChange, DATE_RANGE_OPTIONS } from '@kokotree-inc/ng-bootstrap-date-range-picker';
    
    export class YourComponent implements OnInit {
      dateRangeKey = DATE_RANGE_OPTIONS.Last28Days;
    
      constructor() {}
    
      onRangeChanged(dateRangeChange: DateRangeChange) {
        const { dateRange, startDate, endDate } = dateRangeChange;
        console.log('Date range:', dateRange);
        console.log('Start date:', startDate.format('YYYY-MM-DD'));
        console.log('End date:', endDate.format('YYYY-MM-DD'));
        // do something with the selected date range
      }
    }

Inputs

  • dateRangeKey: The default date range option to show. Possible values are defined in the DATE_RANGE_OPTIONS enum exported by ng-bootstrap-date-range-picker. Default value is DATE_RANGE_OPTIONS.Last28Days.
  • btnApplyClass: The CSS class to apply to the "Apply" button. Default value is 'btn-primary'. pickerCustomClass: The CSS class to apply to the date range picker. Default value is ''.

Outputs

  • rangeChanged: Emitted when the date range selection is changed. The output is an object of type DateRangeChange, which contains the selected date range, start date, and end date.

Playground Project

There is an included playground project for the ng-bootstrap-date-range-picker component, located at projects/ng-bootstrap-date-range-picker-playground.

To run the playground project, navigate to the project directory in the terminal and run:

ng serve

This will start a local server at http://localhost:4200/, where you can run and test the component.

Please note that ng-bootstrap-date-range-picker-playground project is intended for testing and experimentation purposes only, and should not be used in a production environment.