@datarailsshared/datarailsshared 1.3.44 → 1.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/datarailsshared-datarailsshared.umd.js +71 -60
- package/bundles/datarailsshared-datarailsshared.umd.js.map +1 -1
- package/datarailsshared-datarailsshared-1.3.47.tgz +0 -0
- package/datarailsshared-datarailsshared.metadata.json +1 -1
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.component.js +14 -6
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker.service.js +2 -2
- package/esm2015/lib/dr-inputs/dr-date-picker/dr-date-picker_custom-header/dr-date-picker_custom-header.component.js +3 -3
- package/fesm2015/datarailsshared-datarailsshared.js +69 -58
- package/fesm2015/datarailsshared-datarailsshared.js.map +1 -1
- package/lib/dr-inputs/dr-date-picker/dr-date-picker.component.d.ts +2 -0
- package/package.json +1 -1
- package/datarailsshared-datarailsshared-1.3.44.tgz +0 -0
|
@@ -3,7 +3,7 @@ import { EventEmitter, Component, ViewEncapsulation, Input, Output, ChangeDetect
|
|
|
3
3
|
import { FormControl, NG_VALUE_ACCESSOR, NgControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
4
4
|
import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } from '@angular/material/core';
|
|
5
5
|
import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter';
|
|
6
|
-
import * as
|
|
6
|
+
import * as momentImported from 'moment';
|
|
7
7
|
import { isPlatformBrowser, DOCUMENT, CommonModule } from '@angular/common';
|
|
8
8
|
import { Subject, from, merge, fromEvent, noop as noop$1, BehaviorSubject } from 'rxjs';
|
|
9
9
|
import { startWith, switchMap, takeUntil, filter, take, first } from 'rxjs/operators';
|
|
@@ -90,7 +90,7 @@ AnyTagComponent.propDecorators = {
|
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
// @ts-ignore
|
|
93
|
-
const moment$
|
|
93
|
+
const moment$9 = require("moment");
|
|
94
94
|
class ForecastTagComponent extends AnyTagComponent {
|
|
95
95
|
constructor() {
|
|
96
96
|
super();
|
|
@@ -111,10 +111,10 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
111
111
|
{ "value": 11, "label": "11+1" }
|
|
112
112
|
];
|
|
113
113
|
this.dateFilter = (date) => {
|
|
114
|
-
const forecastDate = moment$
|
|
114
|
+
const forecastDate = moment$9.unix(date);
|
|
115
115
|
let status = true;
|
|
116
116
|
this.lockedDate.forEach(timestamp => {
|
|
117
|
-
const locked = moment$
|
|
117
|
+
const locked = moment$9.unix(timestamp);
|
|
118
118
|
return status = !(locked.month() === forecastDate.month() && locked.year() === forecastDate.year());
|
|
119
119
|
});
|
|
120
120
|
return status;
|
|
@@ -130,14 +130,14 @@ class ForecastTagComponent extends AnyTagComponent {
|
|
|
130
130
|
this.forecastValue = this.getFiscalMonthFromDate(dateVal, fiscal_year_starts_from) - 1;
|
|
131
131
|
let fiscal_year = this.getFiscalYearFromDate(dateVal, fiscal_year_starts_from, fiscal_year_back);
|
|
132
132
|
console.log("test", dateVal, fiscal_year_starts_from, this.forecastValue, fiscal_year);
|
|
133
|
-
this.dateObj.date = moment$
|
|
133
|
+
this.dateObj.date = moment$9(new Date(fiscal_year, 0, 1)).format("YYYY");
|
|
134
134
|
this.updateLockedDate();
|
|
135
135
|
}
|
|
136
136
|
updateLockedDate() {
|
|
137
137
|
for (let forecastTag of this.forecastTags) {
|
|
138
138
|
forecastTag.disable = false;
|
|
139
139
|
this.lockedDate.forEach(timestamp => {
|
|
140
|
-
const locked = moment$
|
|
140
|
+
const locked = moment$9.unix(timestamp);
|
|
141
141
|
if (locked.month() - 1 === forecastTag.value && +locked.year() + 1 === +this.dateObj.date) {
|
|
142
142
|
forecastTag.disable = true;
|
|
143
143
|
}
|
|
@@ -231,7 +231,7 @@ ForecastTagComponent.propDecorators = {
|
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
// @ts-ignore
|
|
234
|
-
const moment$
|
|
234
|
+
const moment$8 = require("moment");
|
|
235
235
|
const MONTH_FORMATS = {
|
|
236
236
|
parse: {
|
|
237
237
|
dateInput: "DD-MM-YYYY",
|
|
@@ -248,12 +248,12 @@ class MonthTagComponent extends AnyTagComponent {
|
|
|
248
248
|
constructor() {
|
|
249
249
|
super();
|
|
250
250
|
this.lockedDate = [];
|
|
251
|
-
this.date = new FormControl(moment$
|
|
251
|
+
this.date = new FormControl(moment$8());
|
|
252
252
|
this.dateFilter = (date) => {
|
|
253
|
-
const calendarDate = moment$
|
|
253
|
+
const calendarDate = moment$8(date);
|
|
254
254
|
let status = true;
|
|
255
255
|
this.lockedDate.forEach(timestamp => {
|
|
256
|
-
const lockDate = moment$
|
|
256
|
+
const lockDate = moment$8.unix(timestamp);
|
|
257
257
|
return status = !(lockDate.year() === calendarDate.year() && lockDate.month() === calendarDate.month());
|
|
258
258
|
});
|
|
259
259
|
return status;
|
|
@@ -261,11 +261,11 @@ class MonthTagComponent extends AnyTagComponent {
|
|
|
261
261
|
}
|
|
262
262
|
initDate() {
|
|
263
263
|
if (this.defaultValue) {
|
|
264
|
-
this.dateObj.date = moment$
|
|
265
|
-
this.date = new FormControl(moment$
|
|
264
|
+
this.dateObj.date = moment$8(this.defaultValue * 1000).utc().format("YYYY-MM");
|
|
265
|
+
this.date = new FormControl(moment$8(this.defaultValue * 1000));
|
|
266
266
|
}
|
|
267
267
|
else {
|
|
268
|
-
this.dateObj.date = moment$
|
|
268
|
+
this.dateObj.date = moment$8(new Date()).format("YYYY-MM");
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
initName() {
|
|
@@ -274,7 +274,7 @@ class MonthTagComponent extends AnyTagComponent {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
chosenTagHandler(value) {
|
|
277
|
-
const resultDate = moment$
|
|
277
|
+
const resultDate = moment$8.utc(value);
|
|
278
278
|
resultDate.hour(12);
|
|
279
279
|
const resultTag = {
|
|
280
280
|
name: this.name,
|
|
@@ -312,7 +312,7 @@ MonthTagComponent.propDecorators = {
|
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
// @ts-ignore
|
|
315
|
-
const moment$
|
|
315
|
+
const moment$7 = require("moment");
|
|
316
316
|
class QuarterTagComponent extends AnyTagComponent {
|
|
317
317
|
constructor() {
|
|
318
318
|
super();
|
|
@@ -322,8 +322,8 @@ class QuarterTagComponent extends AnyTagComponent {
|
|
|
322
322
|
this.dateFilter = (date) => {
|
|
323
323
|
let status = true;
|
|
324
324
|
this.lockedDate.forEach(timestamp => {
|
|
325
|
-
const lockDate = moment$
|
|
326
|
-
const quarterDate = moment$
|
|
325
|
+
const lockDate = moment$7.unix(timestamp);
|
|
326
|
+
const quarterDate = moment$7.unix(date.value);
|
|
327
327
|
if (lockDate.year() === quarterDate.year() && lockDate.month() === quarterDate.month()) {
|
|
328
328
|
date.disable = true;
|
|
329
329
|
status = false;
|
|
@@ -354,7 +354,7 @@ class QuarterTagComponent extends AnyTagComponent {
|
|
|
354
354
|
}
|
|
355
355
|
chosenTagHandler(value) {
|
|
356
356
|
const date = new Date(value * 1000);
|
|
357
|
-
const resultDate = moment$
|
|
357
|
+
const resultDate = moment$7.utc(date);
|
|
358
358
|
const resultTag = {
|
|
359
359
|
name: this.name,
|
|
360
360
|
value: parseInt(resultDate.format("X"), 10),
|
|
@@ -411,7 +411,7 @@ QuarterTagComponent.propDecorators = {
|
|
|
411
411
|
};
|
|
412
412
|
|
|
413
413
|
// @ts-ignore
|
|
414
|
-
const moment$
|
|
414
|
+
const moment$6 = require("moment");
|
|
415
415
|
const WEEK_FORMATS = {
|
|
416
416
|
parse: {
|
|
417
417
|
dateInput: "WW-YYYY",
|
|
@@ -428,13 +428,13 @@ class WeekTagComponent extends AnyTagComponent {
|
|
|
428
428
|
constructor() {
|
|
429
429
|
super();
|
|
430
430
|
this.lockedDate = [];
|
|
431
|
-
this.date = new FormControl(moment$
|
|
431
|
+
this.date = new FormControl(moment$6());
|
|
432
432
|
this.selectedValue = "";
|
|
433
433
|
this.dateFilter = (date) => {
|
|
434
|
-
const calendarDate = moment$
|
|
434
|
+
const calendarDate = moment$6(date);
|
|
435
435
|
let status = true;
|
|
436
436
|
this.lockedDate.forEach(timestamp => {
|
|
437
|
-
const lockDate = moment$
|
|
437
|
+
const lockDate = moment$6.unix(timestamp);
|
|
438
438
|
return status = !(lockDate.week() === calendarDate.week() && lockDate.year() === calendarDate.year());
|
|
439
439
|
});
|
|
440
440
|
return status;
|
|
@@ -464,7 +464,7 @@ class WeekTagComponent extends AnyTagComponent {
|
|
|
464
464
|
}
|
|
465
465
|
}
|
|
466
466
|
chosenDateHandler(normalizedDay) {
|
|
467
|
-
const date = moment$
|
|
467
|
+
const date = moment$6(normalizedDay).unix();
|
|
468
468
|
this.chosenTagHandler(date);
|
|
469
469
|
}
|
|
470
470
|
chosenTagHandler(value) {
|
|
@@ -476,7 +476,7 @@ class WeekTagComponent extends AnyTagComponent {
|
|
|
476
476
|
else {
|
|
477
477
|
date = new Date(value * 1000);
|
|
478
478
|
}
|
|
479
|
-
const resultDate = moment$
|
|
479
|
+
const resultDate = moment$6(date);
|
|
480
480
|
const resultTag = {
|
|
481
481
|
name: this.name,
|
|
482
482
|
value: parseInt(resultDate.format("X"), 10),
|
|
@@ -487,8 +487,8 @@ class WeekTagComponent extends AnyTagComponent {
|
|
|
487
487
|
this.dateChange.emit(resultTag);
|
|
488
488
|
}
|
|
489
489
|
getWeekLabel(date) {
|
|
490
|
-
return "W" + this.pad(moment$
|
|
491
|
-
" " + moment$
|
|
490
|
+
return "W" + this.pad(moment$6(date).isoWeek(), 2) +
|
|
491
|
+
" " + moment$6(date).year();
|
|
492
492
|
}
|
|
493
493
|
getUTCTimestamp(date) {
|
|
494
494
|
return Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), 12, 0, 0, 0);
|
|
@@ -501,7 +501,7 @@ class WeekTagComponent extends AnyTagComponent {
|
|
|
501
501
|
return date;
|
|
502
502
|
}
|
|
503
503
|
getWeekNumberByDate(date) {
|
|
504
|
-
return this.pad(moment$
|
|
504
|
+
return this.pad(moment$6(date).isoWeek(), 2);
|
|
505
505
|
}
|
|
506
506
|
pad(n, width, z = "0") {
|
|
507
507
|
z = z || "0";
|
|
@@ -529,7 +529,7 @@ WeekTagComponent.propDecorators = {
|
|
|
529
529
|
};
|
|
530
530
|
|
|
531
531
|
// @ts-ignore
|
|
532
|
-
const moment$
|
|
532
|
+
const moment$5 = require("moment");
|
|
533
533
|
const YEAR_FORMATS = {
|
|
534
534
|
parse: {
|
|
535
535
|
dateInput: "YYYY",
|
|
@@ -546,12 +546,12 @@ class YearTagComponent extends AnyTagComponent {
|
|
|
546
546
|
constructor() {
|
|
547
547
|
super();
|
|
548
548
|
this.lockedDate = [];
|
|
549
|
-
this.date = new FormControl(moment$
|
|
549
|
+
this.date = new FormControl(moment$5());
|
|
550
550
|
this.dateFilter = (date) => {
|
|
551
|
-
const calendarDateYear = moment$
|
|
551
|
+
const calendarDateYear = moment$5(date).year();
|
|
552
552
|
let status = true;
|
|
553
553
|
this.lockedDate.forEach(timestamp => {
|
|
554
|
-
const lockDate = moment$
|
|
554
|
+
const lockDate = moment$5.unix(timestamp);
|
|
555
555
|
return status = !(lockDate.year() === calendarDateYear);
|
|
556
556
|
});
|
|
557
557
|
return status;
|
|
@@ -559,11 +559,11 @@ class YearTagComponent extends AnyTagComponent {
|
|
|
559
559
|
}
|
|
560
560
|
initDate() {
|
|
561
561
|
if (this.defaultValue) {
|
|
562
|
-
this.dateObj.date = moment$
|
|
563
|
-
this.date = new FormControl(moment$
|
|
562
|
+
this.dateObj.date = moment$5(new Date(this.defaultValue * 1000)).utc().format("YYYY");
|
|
563
|
+
this.date = new FormControl(moment$5(this.defaultValue * 1000));
|
|
564
564
|
}
|
|
565
565
|
else {
|
|
566
|
-
this.dateObj.date = moment$
|
|
566
|
+
this.dateObj.date = moment$5(new Date()).format("YYYY");
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
initName() {
|
|
@@ -573,10 +573,10 @@ class YearTagComponent extends AnyTagComponent {
|
|
|
573
573
|
}
|
|
574
574
|
chosenTagHandler(value) {
|
|
575
575
|
const date = new Date();
|
|
576
|
-
const year = moment$
|
|
576
|
+
const year = moment$5(value).year();
|
|
577
577
|
date.setTime(0);
|
|
578
578
|
date.setFullYear(year, 0, 1);
|
|
579
|
-
const resultDate = moment$
|
|
579
|
+
const resultDate = moment$5.utc(date);
|
|
580
580
|
resultDate.hour(12);
|
|
581
581
|
const resultTag = {
|
|
582
582
|
name: this.name,
|
|
@@ -668,7 +668,7 @@ DrTagComponent.propDecorators = {
|
|
|
668
668
|
tagChange: [{ type: Output }]
|
|
669
669
|
};
|
|
670
670
|
|
|
671
|
-
const moment$
|
|
671
|
+
const moment$4 = momentImported;
|
|
672
672
|
class ListTagComponent {
|
|
673
673
|
constructor() {
|
|
674
674
|
this.defaultValue = "";
|
|
@@ -708,7 +708,7 @@ ListTagComponent.propDecorators = {
|
|
|
708
708
|
};
|
|
709
709
|
|
|
710
710
|
// @ts-ignore
|
|
711
|
-
const moment = require("moment");
|
|
711
|
+
const moment$3 = require("moment");
|
|
712
712
|
const DAY_FORMATS = {
|
|
713
713
|
parse: {
|
|
714
714
|
dateInput: "DD-MM-YYYY",
|
|
@@ -725,9 +725,9 @@ class DayTagComponent extends AnyTagComponent {
|
|
|
725
725
|
constructor() {
|
|
726
726
|
super();
|
|
727
727
|
this.lockedDate = [];
|
|
728
|
-
this.date = new FormControl(moment());
|
|
728
|
+
this.date = new FormControl(moment$3());
|
|
729
729
|
this.dateFilter = (date) => {
|
|
730
|
-
const calendarDate = moment(date).unix();
|
|
730
|
+
const calendarDate = moment$3(date).unix();
|
|
731
731
|
let status = true;
|
|
732
732
|
this.lockedDate.forEach(timestamp => {
|
|
733
733
|
return status = !(timestamp === calendarDate);
|
|
@@ -736,10 +736,10 @@ class DayTagComponent extends AnyTagComponent {
|
|
|
736
736
|
};
|
|
737
737
|
}
|
|
738
738
|
initDate() {
|
|
739
|
-
const utcOffsetInMilliseconds = moment().utcOffset() * 60 * 1000;
|
|
740
|
-
this.dateObj.date = moment(moment().valueOf() + utcOffsetInMilliseconds);
|
|
739
|
+
const utcOffsetInMilliseconds = moment$3().utcOffset() * 60 * 1000;
|
|
740
|
+
this.dateObj.date = moment$3(moment$3().valueOf() + utcOffsetInMilliseconds);
|
|
741
741
|
if (this.defaultValue) {
|
|
742
|
-
this.dateObj.date = moment(new Date(this.defaultValue * 1000)).utc();
|
|
742
|
+
this.dateObj.date = moment$3(new Date(this.defaultValue * 1000)).utc();
|
|
743
743
|
this.date.setValue(this.dateObj.date);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
@@ -749,11 +749,11 @@ class DayTagComponent extends AnyTagComponent {
|
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
chosenTagHandler(value) {
|
|
752
|
-
const date = moment(value).unix();
|
|
752
|
+
const date = moment$3(value).unix();
|
|
753
753
|
const resultTag = {
|
|
754
754
|
name: this.name,
|
|
755
755
|
value: date,
|
|
756
|
-
label: moment.unix(date).format("MM/DD/YYYY"),
|
|
756
|
+
label: moment$3.unix(date).format("MM/DD/YYYY"),
|
|
757
757
|
locked: !this.dateFilter(value)
|
|
758
758
|
};
|
|
759
759
|
console.log("resultTag", resultTag);
|
|
@@ -1918,6 +1918,7 @@ class CustomDateFormat {
|
|
|
1918
1918
|
}
|
|
1919
1919
|
}
|
|
1920
1920
|
|
|
1921
|
+
const moment$2 = require('moment');
|
|
1921
1922
|
class DrDatePickerService {
|
|
1922
1923
|
constructor() {
|
|
1923
1924
|
this.timeframe = 'day';
|
|
@@ -1925,7 +1926,7 @@ class DrDatePickerService {
|
|
|
1925
1926
|
this.updatedQuater = new Subject();
|
|
1926
1927
|
}
|
|
1927
1928
|
getQuarterDisplay(value, format) {
|
|
1928
|
-
return 'Q' + moment$
|
|
1929
|
+
return 'Q' + moment$2(value).quarter() + format.charAt(1) + moment$2(value).year();
|
|
1929
1930
|
}
|
|
1930
1931
|
setTimeframe(format) {
|
|
1931
1932
|
const lowerCaseFormat = format.toLowerCase();
|
|
@@ -1954,6 +1955,7 @@ DrDatePickerService.decorators = [
|
|
|
1954
1955
|
},] }
|
|
1955
1956
|
];
|
|
1956
1957
|
|
|
1958
|
+
const moment$1 = require('moment');
|
|
1957
1959
|
class DrDatePickerCustomHeaderComponent {
|
|
1958
1960
|
constructor(_calendar, _dateAdapter, _dateFormats, cdr, datePickerService) {
|
|
1959
1961
|
this._calendar = _calendar;
|
|
@@ -1975,18 +1977,18 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
1975
1977
|
title: 'Month',
|
|
1976
1978
|
value: 'year',
|
|
1977
1979
|
format: MONTH_YEAR_FORMAT,
|
|
1978
|
-
periodLabel: () => String(moment$
|
|
1980
|
+
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
1979
1981
|
}, {
|
|
1980
1982
|
title: 'Quarter',
|
|
1981
1983
|
value: 'none',
|
|
1982
1984
|
format: QUARTER_FORMAT,
|
|
1983
|
-
periodLabel: () => String(moment$
|
|
1985
|
+
periodLabel: () => String(moment$1(this._calendar.activeDate).year())
|
|
1984
1986
|
}, {
|
|
1985
1987
|
title: 'Year',
|
|
1986
1988
|
value: 'multi-year',
|
|
1987
1989
|
format: YEAR_FORMAT,
|
|
1988
1990
|
periodLabel: () => {
|
|
1989
|
-
const currentYear = moment$
|
|
1991
|
+
const currentYear = moment$1(this._calendar.activeDate).year();
|
|
1990
1992
|
const startPeriod = Math.floor(currentYear / 24) * 24;
|
|
1991
1993
|
return startPeriod + '-' + (startPeriod + 23);
|
|
1992
1994
|
}
|
|
@@ -2032,8 +2034,8 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
2032
2034
|
this.setPeriodLabels(chosenTimeframeOption);
|
|
2033
2035
|
this.datePickerService.format.next(chosenTimeframeOption.format);
|
|
2034
2036
|
this.datePickerService.setTimeframe(chosenTimeframeOption.format);
|
|
2035
|
-
if (this.selectedTimeframe ==
|
|
2036
|
-
this.selectedQuarter = moment$
|
|
2037
|
+
if (this.selectedTimeframe == 'none') {
|
|
2038
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
2037
2039
|
}
|
|
2038
2040
|
}
|
|
2039
2041
|
get currentViewIsQuater() {
|
|
@@ -2044,10 +2046,10 @@ class DrDatePickerCustomHeaderComponent {
|
|
|
2044
2046
|
}
|
|
2045
2047
|
onSelectQuater(quarterNumber) {
|
|
2046
2048
|
const monthsInQuarter = 3;
|
|
2047
|
-
this.selectedQuarter = moment$
|
|
2049
|
+
this.selectedQuarter = moment$1(this._calendar.activeDate).quarter();
|
|
2048
2050
|
const unadaptedDate = this._dateAdapter.addCalendarMonths(this._calendar.activeDate, monthsInQuarter * (quarterNumber - this.selectedQuarter));
|
|
2049
2051
|
this._calendar.activeDate = unadaptedDate;
|
|
2050
|
-
this.datePickerService.updatedQuater.next(moment$
|
|
2052
|
+
this.datePickerService.updatedQuater.next(moment$1(unadaptedDate));
|
|
2051
2053
|
this.datePickerService.calendarInstance.close();
|
|
2052
2054
|
}
|
|
2053
2055
|
pagingClicked(forward) {
|
|
@@ -2075,6 +2077,7 @@ DrDatePickerCustomHeaderComponent.ctorParameters = () => [
|
|
|
2075
2077
|
{ type: DrDatePickerService }
|
|
2076
2078
|
];
|
|
2077
2079
|
|
|
2080
|
+
const moment = require('moment');
|
|
2078
2081
|
const noop = () => { };
|
|
2079
2082
|
const ɵ0$1 = noop;
|
|
2080
2083
|
class DrDatePickerComponent {
|
|
@@ -2088,6 +2091,7 @@ class DrDatePickerComponent {
|
|
|
2088
2091
|
this.customHeader = DrDatePickerCustomHeaderComponent;
|
|
2089
2092
|
this.onChangeFormat = new EventEmitter();
|
|
2090
2093
|
this.timeframeSelection = false;
|
|
2094
|
+
this.takeEndOfPeriod = false;
|
|
2091
2095
|
this.placeholder = 'Select';
|
|
2092
2096
|
this.min = null;
|
|
2093
2097
|
this.max = null;
|
|
@@ -2116,7 +2120,9 @@ class DrDatePickerComponent {
|
|
|
2116
2120
|
datePickerService.updatedQuater
|
|
2117
2121
|
.pipe(takeUntil(this._destroyed))
|
|
2118
2122
|
.subscribe((value) => {
|
|
2123
|
+
this.tryToNormalaizeTimeframe(value, 'quarter');
|
|
2119
2124
|
this.writeValue(value);
|
|
2125
|
+
this.onChangeCallback(value);
|
|
2120
2126
|
});
|
|
2121
2127
|
}
|
|
2122
2128
|
set format(value) {
|
|
@@ -2141,13 +2147,17 @@ class DrDatePickerComponent {
|
|
|
2141
2147
|
};
|
|
2142
2148
|
}, 1000);
|
|
2143
2149
|
}
|
|
2150
|
+
tryToNormalaizeTimeframe(normalizedRef, timeframe) {
|
|
2151
|
+
if (this.takeEndOfPeriod) {
|
|
2152
|
+
normalizedRef.endOf(timeframe);
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2144
2155
|
get value() {
|
|
2145
2156
|
return this.innerValue;
|
|
2146
2157
|
}
|
|
2147
2158
|
set value(v) {
|
|
2148
2159
|
if (v !== this.innerValue) {
|
|
2149
2160
|
this.innerValue = v;
|
|
2150
|
-
this.onChangeCallback(v);
|
|
2151
2161
|
}
|
|
2152
2162
|
this.cdr.markForCheck();
|
|
2153
2163
|
}
|
|
@@ -2160,14 +2170,12 @@ class DrDatePickerComponent {
|
|
|
2160
2170
|
writeValue(value) {
|
|
2161
2171
|
if (value !== this.innerValue) {
|
|
2162
2172
|
if (value && typeof value === 'number') {
|
|
2163
|
-
this.innerValue = moment
|
|
2173
|
+
this.innerValue = moment.unix(value);
|
|
2164
2174
|
}
|
|
2165
2175
|
else {
|
|
2166
2176
|
this.innerValue = value;
|
|
2167
2177
|
}
|
|
2168
|
-
|
|
2169
|
-
moment$7(value).endOf(this.datePickerService.timeframe);
|
|
2170
|
-
}
|
|
2178
|
+
this.tryToNormalaizeTimeframe(this.innerValue, this.datePickerService.timeframe);
|
|
2171
2179
|
this.cdr.markForCheck();
|
|
2172
2180
|
}
|
|
2173
2181
|
}
|
|
@@ -2185,6 +2193,7 @@ class DrDatePickerComponent {
|
|
|
2185
2193
|
}
|
|
2186
2194
|
chosenMonthHandler(normalizedMonth, datepicker) {
|
|
2187
2195
|
if (this.datePickerService.timeframe == 'month') {
|
|
2196
|
+
this.tryToNormalaizeTimeframe(normalizedMonth, 'month');
|
|
2188
2197
|
this.writeValue(normalizedMonth);
|
|
2189
2198
|
this.onChangeCallback(normalizedMonth);
|
|
2190
2199
|
datepicker.close();
|
|
@@ -2192,6 +2201,7 @@ class DrDatePickerComponent {
|
|
|
2192
2201
|
}
|
|
2193
2202
|
chosenYearHandler(normalizedYear, datepicker) {
|
|
2194
2203
|
if (this.datePickerService.timeframe == 'year') {
|
|
2204
|
+
this.tryToNormalaizeTimeframe(normalizedYear, 'year');
|
|
2195
2205
|
this.writeValue(normalizedYear);
|
|
2196
2206
|
this.onChangeCallback(normalizedYear);
|
|
2197
2207
|
datepicker.close();
|
|
@@ -2236,6 +2246,7 @@ DrDatePickerComponent.propDecorators = {
|
|
|
2236
2246
|
onChangeFormat: [{ type: Output }],
|
|
2237
2247
|
format: [{ type: Input }],
|
|
2238
2248
|
timeframeSelection: [{ type: Input }],
|
|
2249
|
+
takeEndOfPeriod: [{ type: Input }],
|
|
2239
2250
|
placeholder: [{ type: Input }],
|
|
2240
2251
|
min: [{ type: Input }],
|
|
2241
2252
|
max: [{ type: Input }],
|