UNPKG

ng-mat-daterange-picker

Version:

[![CircleCI](https://circleci.com/gh/ashishgkwd/ngx-mat-daterange-picker.svg?style=shield)](https://circleci.com/gh/ashishgkwd/ngx-mat-daterange-picker) [![Maintainability](https://api.codeclimate.com/v1/badges/2b0d09a866f6d2ed139c/maintainability)](https

39 lines (30 loc) 963 B
import { Injectable, Inject, InjectionToken } from '@angular/core'; import { Range } from '../model/model'; import { Subject } from 'rxjs'; /* import { DATE } from '../ngx-drp.module'; */ export const DATE = new InjectionToken<Date>('date'); @Injectable() export class RangeStoreService { rangeUpdate$: Subject<Range> = new Subject<Range>(); constructor( @Inject(DATE) private _fromDate: Date, @Inject(DATE) private _toDate: Date ) {} /* set fromDate(fromDate:Date) { this._fromDate = fromDate; } */ get fromDate(): Date { return this._fromDate; } /* set toDate(toDate:Date) { this._toDate = toDate; } */ get toDate(): Date { return this._toDate; } updateRange(fromDate: Date = this._fromDate, toDate: Date = this._toDate) { this._fromDate = fromDate; this._toDate = toDate; this.rangeUpdate$.next({ fromDate: this._fromDate, toDate: this._toDate }); } }