{"id":13808330,"url":"https://github.com/fetrarij/ngx-daterangepicker-material","last_synced_at":"2025-04-11T16:38:41.248Z","repository":{"id":30794602,"uuid":"126018333","full_name":"fetrarij/ngx-daterangepicker-material","owner":"fetrarij","description":"Pure Angular 2+ date range picker with material design theme, a demo here: ","archived":false,"fork":false,"pushed_at":"2024-07-15T16:32:52.000Z","size":11981,"stargazers_count":255,"open_issues_count":192,"forks_count":257,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-29T22:33:29.163Z","etag":null,"topics":["angular10","angular11","angular12","angular2","angular4","angular5","angular6","angular7","angular8","angular9","daterange","daterangepicker","dayjs","directive","material","ngx","picker","range-picker"],"latest_commit_sha":null,"homepage":"https://fetrarij.github.io/ngx-daterangepicker-material/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fetrarij.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":"fetrarij","issuehunt":"fetrarij","otechie":null,"custom":null}},"created_at":"2018-03-20T13:03:02.000Z","updated_at":"2025-02-10T19:29:12.000Z","dependencies_parsed_at":"2024-03-21T10:16:45.866Z","dependency_job_id":"b922eae5-c7d3-4e60-b887-126e6a0866b9","html_url":"https://github.com/fetrarij/ngx-daterangepicker-material","commit_stats":{"total_commits":451,"total_committers":50,"mean_commits":9.02,"dds":"0.31707317073170727","last_synced_commit":"779077f7b5897f02cbac14e045cb4a41e52360bb"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetrarij%2Fngx-daterangepicker-material","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetrarij%2Fngx-daterangepicker-material/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetrarij%2Fngx-daterangepicker-material/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fetrarij%2Fngx-daterangepicker-material/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fetrarij","download_url":"https://codeload.github.com/fetrarij/ngx-daterangepicker-material/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247415967,"owners_count":20935388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular10","angular11","angular12","angular2","angular4","angular5","angular6","angular7","angular8","angular9","daterange","daterangepicker","dayjs","directive","material","ngx","picker","range-picker"],"created_at":"2024-08-04T01:01:40.230Z","updated_at":"2025-04-11T16:38:41.227Z","avatar_url":"https://github.com/fetrarij.png","language":"TypeScript","funding_links":["https://liberapay.com/fetrarij","https://issuehunt.io/r/fetrarij"],"categories":["Table of contents"],"sub_categories":["Third Party Components"],"readme":"# ngx-daterangepicker-material\n\n\u003e Angular 2+ Date range picker.\n\n[![Build Status](https://github.com/fetrarij/ngx-daterangepicker-material/actions/workflows/actions.yml/badge.svg)](https://github.com/fetrarij/ngx-daterangepicker-material/actions)\n[![npm version](https://badge.fury.io/js/ngx-daterangepicker-material.svg)](https://badge.fury.io/js/ngx-daterangepicker-material)\n[![last commit](https://img.shields.io/github/last-commit/fetrarij/ngx-daterangepicker-material.svg)](https://github.com/fetrarij/ngx-daterangepicker-material/commits/master)\n\nThis `Angular Material` plugin is compatible with Angular 2+ and is Ivy compatible. It leverages `dayjs` to handle date manipulation and parsing. The base for this plugin was originally the [Bootstrap Date Range Picker](http://www.daterangepicker.com), but its dependencies on jQuery, Bootstrap and dayjs.js were removed.\n\n![](screen.png)\n\nDemo: https://fetrarij.github.io/ngx-daterangepicker-material/\n\n---\n\n## Versions\n\n| Angular| ngx-daterangepicker-material|\n| ------|:------:|\n| \u003e=12.0.0  | v6.x.x |\n| \u003c=11.0.0  | v5.x.x |\n| \u003e=9.0.0  | v4.x.x |\n| \u003c9.0.0  | v2.x.x |\n| ~~\u003e=9.0.0 depends on @angular/material~~ |~~v3.x~~ |\n\n---\n\n## Installation\n\n Install the plugin from npm:\n\n `npm install ngx-daterangepicker-material --save` .\n\n import **NgxDaterangepickerMd** in your module:\n\n````typescript\n...\nimport { FormsModule } from '@angular/forms';\nimport { NgxDaterangepickerMd } from 'ngx-daterangepicker-material';\nimport { App } from './app';\n\n@NgModule({\n    imports: [\n        ... ,\n        FormsModule,\n        NgxDaterangepickerMd.forRoot()\n    ],\n    declarations: [App],\n    bootstrap:    [App]\n})\nexport class AppModule {}\n````\n\n## Usage example\n\nHtml:\n\n```html\n\u003cinput type=\"text\" ngxDaterangepickerMd [(ngModel)]=\"selected\" class=\"form-control\"/\u003e\n```\nTypescript:\n\n````typescript\nselected: {startDate: Dayjs, endDate: Dayjs};\n````\n### with some options:\nHtml:\n\n```html\n\u003cinput type=\"text\" matInput\n    ngxDaterangepickerMd\n    [locale]=\"{applyLabel: 'ok', format: 'DD-MM-YYYY'}\"\n    startKey=\"start\"\n    endKey=\"end\"\n    [(ngModel)]=\"selected\"\n    name=\"daterange\"/\u003e\n```\nTypescript:\n\n````typescript\nselected: {start: Dayjs, end: Dayjs};\n````\nYou can [play with our online demo here](https://fetrarij.github.io/ngx-daterangepicker-material/)\nand [browse our demo code here](./demo/src/app).\n\n## Inline usage\n\nYou can use the component directly in your templates, which will set its `inline` mode to **true**, in which case the calendar won't hide after date/range selection. You can then use the events: `rangeClicked` or `datesUpdated` or `choosedDate` to get its selection state.\n\n```html\n\u003cngx-daterangepicker-material (choosedDate)=\"choosedDate($event)\"\u003e\n\u003c/ngx-daterangepicker-material\u003e\n```\n\n\n## Available options\n\n### autoApply, showDropdowns, singleDatePicker, showWeekNumbers, showISOWeekNumbers, alwaysShowCalendars, showClearButton, showCancel\n\n\u003eThese options are booleans\n\n### isCustomDate\n\n\u003e(function) A function that is passed each date in the calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell\n\n### isInvalidDate\n\u003e(function) A function that is passed each date in the two calendars before they are displayed, and may return true or false to indicate whether that date should be available for selection or not.\n\n### isTooltipDate\n\u003e(function) A function that is passed each date in the two calendars before they are displayed, and may return a text to be displayed as a tooltip.\n\n### minDate, maxDate\n\n \u003eTo set the minimal and maximal date, these options are either a dayjs date or string in [ISO](https://www.w3.org/QA/Tips/iso-date) format\n\n### dateLimit\n\n \u003eTo set max number of the date we can choose\n\n### locale\n\n\u003ethe locale options is an object with:\n```javascript\n{\n    format: 'MM/DD/YYYY', // could be 'YYYY-MM-DDTHH:mm:ss.SSSSZ'\n    displayFormat: 'MM/DD/YYYY', // default is format value\n    direction: 'ltr', // could be rtl\n    weekLabel: 'W',\n    separator: ' To ', // default is ' - '\n    cancelLabel: 'Cancel', // detault is 'Cancel'\n    applyLabel: 'Okay', // detault is 'Apply'\n    clearLabel: 'Clear', // detault is 'Clear'\n    customRangeLabel: 'Custom range',\n    daysOfWeek: dayjs.weekdaysMin(),\n    monthNames: dayjs.monthsShort(),\n    firstDay: 1 // first day is monday\n}\n```\n[Check here](#global-locale) for setting the global locale\n\n### startKey and endKey\n\nTheses 2 options are for the key you want for the value, default are `startDate` and `endDate`, it means the value we have from ngModel are: `{startDate: Date, endDate: Date}` by default;\n\nSpecifiyng `startKey` and `endKey` would have different model:\n\nexample:\n```html\n\u003cinput type=\"text\" ngxDaterangepickerMd startKey=\"start\" endKey=\"end\" [(ngModel)]=\"model\"\u003e\n```\n\nthe model we got would be:  `{start: Date, end: Date}`\n\n### ranges\n\n(object) Set predefined date ranges the user can select from. Each key is the label for the range, and its value an array with two dates representing the bounds of the range. As an example:\n```html\n\u003cinput type=\"text\" ngxDaterangepickerMd startKey=\"start\" endKey=\"end\" [ranges]=\"ranges\" [(ngModel)]=\"model\"\u003e\n```\n```javascript\nranges: any = {\n    'Today': [dayjs(), dayjs()],\n    'Yesterday': [dayjs().subtract(1, 'days'), dayjs().subtract(1, 'days')],\n    'Last 7 Days': [dayjs().subtract(6, 'days'), dayjs()],\n    'Last 30 Days': [dayjs().subtract(29, 'days'), dayjs()],\n    'This Month': [dayjs().startOf('month'), dayjs().endOf('month')],\n    'Last Month': [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')]\n  }\n```\n#### Other options with ranges\n\nYou can use bellow options when using the ranges. The default are `false`.\n\n| Attribut | Type |Description |\n| --- | --- |--- |\n| alwaysShowCalendars | boolean | set to `true` if you want to display the ranges with the calendar |\n| keepCalendarOpeningWithRange | boolean | set to `true` if you want the calendar won't be closed after choosing a range |\n| showRangeLabelOnInput | boolean | set to `true` if you want to display the range label on input |\n| customRangeDirection | boolean | set to `true` if you want to allow selection range from end date first |\n| lockStartDate | boolean | set to `true` if you want to lock start date and change only the end date |\n\n#### Open datepicker from outside\n\nIt is possible to open datepicker from outside. You should create an input with attached datepicker directive and a button with \"ngx-daterangepicker-action\" class (to prevent triggering of clickOutside).\n```html\n    \u003cinput\n      ngxDaterangepickerMd\n      [closeOnAutoApply]=\"true\"\n      [autoApply]=\"true\"\n      [singleDatePicker]=\"true\"\n      [linkedCalendars]=\"true\"\n      [(ngModel)]=\"selected\"\n      (datesUpdated)=\"datesUpdated($event)\"\n      class=\"datepicker-calendar-icon\"\u003e\n\n    \u003ca class=\"ngx-daterangepicker-action\" (click)=\"openDatepicker()\"\u003e\n      Open\n    \u003c/a\u003e\n```\n\n```javascript\n\n  ...\n    @ViewChild(DaterangepickerDirective, { static: false }) pickerDirective: DaterangepickerDirective;\n  ...\n  ...\n  openDatepicker() {\n    this.pickerDirective.open();\n  }\n```\n\n### Timepicker\n\nYou have to set the attribute `timePicker` to `true` if you want to enable the timepicker.\n\nYou can use theses options:\n\n| Attribut | Type |Description |\n| --- | --- |--- |\n| timePicker24Hour | boolean | set to `true` if you want to set the timepicker to 24h instead of having AM and PM |\n| timePickerIncrement | number | set the value increment of the minutes (eg: for `12` there would be 0mn, 15mn, 30mn, 45mn,) |\n| timePickerSeconds | boolean | set `true` if you want do display second's select |\n\n\n### Customisation\n\n| Attribut | Type |Description |\n| --- | --- |--- |\n| firstMonthDayClass | string | add a custom class for all first day of the month |\n| lastMonthDayClass | string | add a custom class for all last day of the month |\n| emptyWeekRowClass | string | add a custom class in a row with a date in a week not in the current month |\n| emptyWeekColumnClass | string | add a custom class for all date in a week not in the current month |\n| lastDayOfPreviousMonthClass | string | add a custom class for the last day of the previous month |\n| firstDayOfNextMonthClass | string | add a custom class for the first day of the next month |\n\n### Positioning\n\n| Attribut | Possible values |Description |\n| --- | --- |--- |\n| opens | left, center, right | position the calendar from the input element |\n| drops | up, down | position the calendar to the up or down of the calendar |\n\n## Available events\n\n### \\(rangeClicked)\n\n \u003eFired when clicked on range, and send an object with range label and dates value, eg:  `{label: 'This Month', dates: [Dayjs, Dayjs]}`\n\n### \\(datesUpdated)\n\n \u003eFires when the date model is updated, like applying (if you have activated the apply button), or when selecting a range or date without the apply button, and sends an object containing start and end dates, eg: `{startDate: Dayjs, endDate: Dayjs}`\n\n### \\(clearClicked)\n\n \u003eFired when clicked on the clear button\n\n### Global locale\n\nFor setting the global locale, pass this object to NgxDaterangepickerMd.forRoot().\n\neg:\n\n```\n@NgModule({\n    imports: [\n        ... ,\n        FormsModule,\n        NgxDaterangepickerMd.forRoot({\n            separator: ' - ',\n            applyLabel: 'Okay',\n        })\n    ],\n    declarations: [App],\n    bootstrap:    [App]\n})\n```\n\n## Development\n\n### Prepare your environment\n\nInstall local dependencies: `npm install`.\n\n### Development server\n\nRun `npm start` to start a development server on a port 4200.\n\nOpen `http//:localhost:4200` on your browser.\n\n## Tests\n\nRun `npm test` or `ng test` to run tests.\n\n\n## [License](https://github.com/fetrarij/ngx-daterangepicker-material/blob/master/LICENSE)\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetrarij%2Fngx-daterangepicker-material","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffetrarij%2Fngx-daterangepicker-material","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffetrarij%2Fngx-daterangepicker-material/lists"}