@smartsoft001/angular 1.1.813 → 1.1.814
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/esm2020/lib/components/date-edit/date-edit.component.mjs +3 -2
- package/esm2020/lib/components/date-range/date-range.component.mjs +3 -2
- package/esm2020/lib/components/input/date/date.component.mjs +3 -2
- package/esm2020/lib/directives/date-validator/date-validator.directive.mjs +3 -2
- package/fesm2015/smartsoft001-angular.mjs +12 -13
- package/fesm2015/smartsoft001-angular.mjs.map +1 -1
- package/fesm2020/smartsoft001-angular.mjs +12 -13
- package/fesm2020/smartsoft001-angular.mjs.map +1 -1
- package/lib/components/date-range/date-range.component.d.ts +1 -1
- package/package.json +5 -5
|
@@ -56,8 +56,7 @@ import { DateAdapter, MAT_DATE_LOCALE, MAT_DATE_FORMATS, MatNativeDateModule } f
|
|
|
56
56
|
import { MomentDateAdapter, MAT_MOMENT_DATE_ADAPTER_OPTIONS, MomentDateModule } from '@angular/material-moment-adapter';
|
|
57
57
|
import * as i6 from '@angular/cdk/table';
|
|
58
58
|
import { CdkTableModule } from '@angular/cdk/table';
|
|
59
|
-
import
|
|
60
|
-
import moment__default from 'moment';
|
|
59
|
+
import moment from 'moment';
|
|
61
60
|
import * as i5$2 from '@angular/cdk/overlay';
|
|
62
61
|
import * as i1$5 from '@ngrx/effects';
|
|
63
62
|
import { createEffect, EffectsModule } from '@ngrx/effects';
|
|
@@ -3086,7 +3085,7 @@ class CalendarService {
|
|
|
3086
3085
|
this.state = { ...this.state, ...nextState };
|
|
3087
3086
|
};
|
|
3088
3087
|
this.state = {
|
|
3089
|
-
date:
|
|
3088
|
+
date: moment().add(2, 'year'),
|
|
3090
3089
|
calendar: [
|
|
3091
3090
|
{
|
|
3092
3091
|
dates: null,
|
|
@@ -3103,7 +3102,7 @@ class CalendarService {
|
|
|
3103
3102
|
}
|
|
3104
3103
|
generatePrevMonths() {
|
|
3105
3104
|
const calendar = this.state.calendar;
|
|
3106
|
-
let date =
|
|
3105
|
+
let date = moment(calendar[0].year + '-' + calendar[0].number + '-01');
|
|
3107
3106
|
const dateYearAgo = date.clone().subtract(1, 'year');
|
|
3108
3107
|
while (date.isSameOrAfter(dateYearAgo)) {
|
|
3109
3108
|
date = date.clone().subtract(1, 'month');
|
|
@@ -3113,7 +3112,7 @@ class CalendarService {
|
|
|
3113
3112
|
generateNextMonths() {
|
|
3114
3113
|
const calendar = this.state.calendar;
|
|
3115
3114
|
const dateString = calendar[calendar.length - 1].year + '-' + calendar[calendar.length - 1].number + '-01';
|
|
3116
|
-
let date =
|
|
3115
|
+
let date = moment(dateString);
|
|
3117
3116
|
const dateYearNext = date.clone().add(1, 'year');
|
|
3118
3117
|
while (date.isSameOrBefore(dateYearNext)) {
|
|
3119
3118
|
date = date.clone().add(1, 'month');
|
|
@@ -3124,12 +3123,12 @@ class CalendarService {
|
|
|
3124
3123
|
const { date } = this.state;
|
|
3125
3124
|
const firstMonth = this.generateMonth(date);
|
|
3126
3125
|
const calendar = [firstMonth];
|
|
3127
|
-
const currentDate =
|
|
3126
|
+
const currentDate = moment().clone();
|
|
3128
3127
|
const dateYearAgo = currentDate.clone().subtract(2, 'year');
|
|
3129
3128
|
while (date.isSameOrAfter(dateYearAgo)) { // creating one year calendar
|
|
3130
3129
|
calendar.unshift(this.previousMonth());
|
|
3131
3130
|
}
|
|
3132
|
-
this.state.date =
|
|
3131
|
+
this.state.date = moment();
|
|
3133
3132
|
const currentMonthIndex = calendar.length - 13;
|
|
3134
3133
|
calendar[currentMonthIndex].dates = calendar[currentMonthIndex].dates.filter(this.filterFutureDates);
|
|
3135
3134
|
this.setState({ calendar: calendar });
|
|
@@ -3145,13 +3144,13 @@ class CalendarService {
|
|
|
3145
3144
|
if (!date) {
|
|
3146
3145
|
return true;
|
|
3147
3146
|
}
|
|
3148
|
-
return date.isSameOrBefore(
|
|
3147
|
+
return date.isSameOrBefore(moment());
|
|
3149
3148
|
}
|
|
3150
3149
|
generateMonth(date) {
|
|
3151
|
-
const firstDay =
|
|
3152
|
-
const monthName =
|
|
3153
|
-
const year =
|
|
3154
|
-
const number =
|
|
3150
|
+
const firstDay = moment(date).startOf('month');
|
|
3151
|
+
const monthName = moment(date).format('MMMM');
|
|
3152
|
+
const year = moment(date).format('YYYY');
|
|
3153
|
+
const number = moment(date).format('MM');
|
|
3155
3154
|
const monthLength = date.daysInMonth();
|
|
3156
3155
|
const totalDatesInMonth = this.generateMonthDates(firstDay, monthLength);
|
|
3157
3156
|
const emptyCellsBeforeFirstDay = Array(firstDay.weekday()).fill(null);
|
|
@@ -3164,7 +3163,7 @@ class CalendarService {
|
|
|
3164
3163
|
};
|
|
3165
3164
|
}
|
|
3166
3165
|
generateMonthDates(firstDay, length) {
|
|
3167
|
-
return Array(length).fill(null).map((v, i) =>
|
|
3166
|
+
return Array(length).fill(null).map((v, i) => moment(firstDay).add(i, 'day'));
|
|
3168
3167
|
}
|
|
3169
3168
|
}
|
|
3170
3169
|
/** @nocollapse */ /** @nocollapse */ CalendarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.7", ngImport: i0, type: CalendarService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|