Giter Site home page Giter Site logo

changhuixu / date-range-picker Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 5.0 2.45 MB

Angular components for Date Range Picker and Date Picker using ng-bootstrap

Home Page: https://changhuixu.github.io/date-range-picker/

HTML 23.80% TypeScript 68.63% CSS 2.39% JavaScript 5.17%
datepicker daterangepicker angular daterange-picker boostrap4 bootstrap ngbootstrap date-range-picker daterange date-range

date-range-picker's Introduction

DateRangePicker

An Angular library of Date Range Picker. Dependencies: Angular, ng-bootstrap, Bootstrap >4 (css)

Since v7.0.0, this library is only compatible with Angular >=13 and ng-bootstrap >=12.

Since v6.0.0, this library is only compatible with Angular >=13 and ng-bootstrap >=11.

Since v5.0.0, this library is only compatible with Angular >=12 and ng-bootstrap >=10.

Since v4.0.0, this library is only compatible with Angular >=10 and ng-bootstrap >=7.

Since v3.0.0, this library requires @angular/localize, due to updates in Angular 9 and ng-bootstrap 6.

Build Status npm

npm i @uiowa/date-range-picker

date range picker demo

Models

  • DateRange: an object represents a date range, includes start date and end date. e.g.,
const d1 = new DateRange();
const d2 = new DateRange(new Date(), new Date(2018, 9, 10));
const d3 = DateRange.nextTwoWeeks();
const d4 = DateRange.nextDays(10);
const d5 = DateRange.nextMonth();

Components

  • <date-picker></date-picker>: a wrapper of ng-bootstrap date picker

  • <date-range-picker></date-range-picker>: a date range picker based on ng-bootstrap

Usage

import { DateRangePickerModule } from '@uiowa/date-range-picker';

@NgModule({
  declarations: [AppComponent],
  imports: [
    ...,
    DateRangePickerModule,
    ...
    ],
  providers: [],
  bootstrap: [AppComponent]
})
// in your component.html
<date-range-picker
  [(dateRange)]="dateRange"
  [maxDate]="maxDate"
></date-range-picker>
<date-picker [(date)]="date"></date-picker>
import { Component, OnInit } from '@angular/core';
import { DateRange } from '@uiowa/date-range-picker';

@Component({
  ...
})
export class AppComponent implements OnInit {
  dateRange = new DateRange();
  maxDate = new Date();
  date: Date;
  ngOnInit(): void {
    this.maxDate.setDate(this.maxDate.getDate() + 20);
  }
}

date-range-picker's People

Contributors

angular-cli avatar changhuixu avatar dependabot[bot] avatar jacobbp25 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

date-range-picker's Issues

Opening picker on dates before/after current two months doesn't display range

Opening the datepicker should default to opening with part of the selected range instead of todays month + the next month.

For example. If today is 11/11/18 opening the date picker will display September and October, even if the range is 1/1/2018 to 1/15/2018.

Expected results should display the end of the range as part of the displayed months.

Single Date selection

I want to select a single date but is not working. The DateRange.end cannot have value nor the calendar close. Could you add this feature if it's not yet done done.

Can't able to use this dependency

node_modules/@angular/core/core"' has no exported member 'ɵɵFactoryDeclaration'.

15 static ɵfac: i0.ɵɵFactoryDeclaration<DatePickerComponent, never>;

When setting default date opening picker does not reflect these values

Reproduce
Set default date for date picker to be not the current month. See the default values on the page and open calendar, the calendar does not reflect the range values.

Example:
//ts
creditLimitRange = new DateRange(
new Date(2018, 10, 24),
new Date(2018, 11, 1)
);
//html
<date-range-picker id="creditLimitDate" [(dateRange)]="creditLimitRange">

After rendering the input will have dates "11/24/2018 - 12/1/2018" but opening the datepicker will not have that range selected, just todays date.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.