ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - BhavinPatel04/ngx-datetime-range-picker: Angular material datetime range picker with daily, weekly, monthly, quarterly & yearly levels
Angular material datetime range picker with daily, weekly, monthly, quarterly & yearly levels - BhavinPatel04/ngx-datetime-range-picker
Visit Site

GitHub - BhavinPatel04/ngx-datetime-range-picker: Angular material datetime range picker with daily, weekly, monthly, quarterly & yearly levels

GitHub - BhavinPatel04/ngx-datetime-range-picker: Angular material datetime range picker with daily, weekly, monthly, quarterly & yearly levels

ngx-datetime-range-picker

Ngx Date time range picker with daily, weekly, monthly, quarterly & yearly levels

Build Status npm version

This plugin uses bootstrap and moment.js

Demo

React version

reactjs-datetime-range-picker

Installation

Install the plugin from npm:

npm install ngx-datetime-range-picker --save

import NgxDatetimeRangePickerModule in your module:

import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
...
import { FormsModule } from "@angular/forms";
import { NgxDatetimeRangePickerModule } from "ngx-datetime-range-picker";
import { AppComponent } from "./app.component";

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

Tell ngx-datetime-range-picker which theme to use:

SCSS

Add below config in your style.scss/some-cool-name-theme.scss, which has material theme (or not) and is imported in your angular.json

// Top of the file
@use "ngx-datetime-range-picker/ngx-datetime-range-picker.component.scss" as ndtrp;

// You would need to include the themes for below components if you are not including them already
@include mat.form-field-theme($your-app-theme);
@include mat.icon-theme($your-app-theme);
@include mat.button-theme($your-app-theme);
@include mat.select-theme($your-app-theme);

@include ndtrp.ngx-datetime-range-picker-theme($your-app-theme);

If you don't have a theme and want to use library's default theme

// Top of the file
@use "ngx-datetime-range-picker/ngx-datetime-range-picker.component.scss" as ndtrp;

// You would need to include the themes for below components if you are not including them already
@include mat.form-field-theme(ndtrp.$ndtrp-app-theme);
@include mat.icon-theme(ndtrp.$ndtrp-app-theme);
@include mat.button-theme(ndtrp.$ndtrp-app-theme);
@include mat.select-theme(ndtrp.$ndtrp-app-theme);

@include ndtrp.ngx-datetime-range-picker-theme();

Note: Themes for components are not included in the library to avoid duplicate styles error

CSS

Add below config in your style.css/some-cool-name-theme.css and is imported in your angular.json

@import "ngx-datetime-range-picker/ngx-datetime-range-picker.theme.css";

Note: Make sure whichever file you are adding this to should be imported in angular.json

Usage example

Html:

<ngx-datetime-range-picker
  name="date"
  [options]="datePickerOptions"
  [settings]="datePickerSettings"
  [(dateRangeModel)]="selectedDate"
  (dateRangeChanged)="onFilterChange($event)"
  required
>
</ngx-datetime-range-picker>

Typescript:

selectedDate: {
    daily: {
        startDate: "2018-10-13",
        endDate: "2018-10-19",
      },
    weekly: {
        startDate: "2018-10-13",
        endDate: "2018-10-19",
    },
    monthly: {
        startDate: "2018-10-13",
        endDate: "2018-10-19",
    },
    quarterly: {
        startDate: "2018-10-13",
        endDate: "2018-10-19",
    },
    yearly: {
        startDate: "2018-10-13",
        endDate: "2018-10-19",
    }
};

Options

Option Type Description
dateArray Array Only the dates in the array will be enabled
startDate string Start date
endDate string End date
minDate string Min date
maxDate string Max date
startTime string Start time (only for timepicker)
endTime string End time (only for timepicker)
minTime string Min time (only for timepicker)
maxTime string Max time (only for timepicker)

Settings

Setting Type Default Description
type string 'daily' type (daily
timePicker boolean false enable/disable timepicker
inputDateFormat string "YYYY-MM-DD" input date format
viewDateFormat string "YYYY-MM-DD" date format to view the date in
outputDateFormat string "YYYY-MM-DD" date format in which change event will return the date in
singleDatePicker boolean false enable/disable single date picker
componentDisabled string false enable/disable component
placeholder string "Select Date" placeholder/title of the component
showRowNumber boolean true hide/show week numers for daily
availableRanges Object {"Last 7 Days": {startDate: inputDateFormat, endDate: inputDateFormat}, "Last 30 days": {...}, "Last 90 days": {...}} ranges to show
showRanges boolean true hide/show ranges
disableWeekends boolean false enable/disable weekends
disableWeekdays boolean false enable/disable weekdays
displayBeginDate boolean false show begin date in input
displayEndDate boolean false show end date in input

License

MIT

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory