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

@qqnc/ngx-daterangepicker

v0.0.16

Published

the date range picker mimic from daterangepicker.js and implement it in Angular way

Downloads

73

Readme

ngx-daterangepicker

npm version

Check DEMO

Install

npm install @qqnc/ngx-daterangepicker --save

Configuration

Ensure you import the module and the dependencies: In your module files. e.g. app.module.ts


import { NgxDaterangepickerModule } from '@qqnc/ngx-daterangepicker';

@NgModule({
   imports: [
      BrowserModule,
      NgxDaterangepickerModule

       ...OtherModules 
   ] // along with your other modules
})
export class AppModule {}

Declare in your html


<lib-daterangepicker [(start)]="start" [(end)]="end" format="MM-DD-YYYY" opens="left" [pill]="true"></lib-daterangepicker>

Properties

start - [(string | moment)] - two-way binding variable of the start date. It will also return when you apply.

end - [(string | moment)] - two-way binding variable of the end date. It will also return when you apply.

Properties (optional)

format - [string] - the format of the input. e.g: MM-DD-YYYY.

outputFormat - [string] - the format of the return. e.g: MM-DD-YYYY.

minDate - [string | moment] - the earlist date that user can select.

maxDate - [string | moment] - the lastest date that user can select.

opens - [string] - the side of the opened calendar. options: "left" or "right".

pill - [boolean] - the style of the button. pill button if true, input field if false.

ranges - [boolean or array] - show ranges options. shown if true, hide if false.

complete - (function) - the callback after selection. e.g: (complete)="testCallback($event)". $event will return { start: , string, end: string }

Custom Ranges

import the moment.js

import * as moment from 'moment';

Define the custom range menu

customRanges = [
    {
      text: 'Today', desc: 'Today', value: 'today',
      start: moment(),
      end: moment(),
      default: true
    },
    {
      text: 'Last 3 Months', desc: 'Last 3 Months', value: 'last3month',
      start: moment().subtract(3, 'month').startOf('month'),
      end: moment().subtract(1, 'month').endOf('month')
    },
    {
      text: 'Last 6 Month', desc: 'Last Month', value: 'lastmonth',
      start: moment().subtract(6, 'month').startOf('month'),
      end: moment().subtract(1, 'month').endOf('month')
    },
    {
      text: 'This Year', desc: 'This Year', value: 'thisyear',
      start: moment().startOf('year'),
      end: moment().endOf('year')
    },
    {
      text: 'Last Year', desc: 'Last Year', value: 'lastyear',
      start: moment().subtract(1, 'year').startOf('year'),
      end: moment().subtract(1, 'year').endOf('year')
    }
  ];

Bind it with ranges

[ranges]="customRanges"

Check the example in DEMO page

Run demo in development environment

Fork, code, and build it, then run demo.

Build the library

run npm run build

Test the library in demo

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

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History