Switched on the @typescript-eslint/no-non-null-assertion rule in eslint.
Fixed the errors it threw up.
This commit is contained in:
@@ -50,14 +50,14 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
chosenYearHandler(normalizedYear: Moment) {
|
||||
const ctrlValue = this.creditSalaryForm.value.date!;
|
||||
const ctrlValue = this.creditSalaryForm.value.date ?? moment();
|
||||
ctrlValue.year(normalizedYear.year());
|
||||
ctrlValue.date(ctrlValue.daysInMonth());
|
||||
this.creditSalaryForm.setValue({ date: ctrlValue });
|
||||
}
|
||||
|
||||
chosenMonthHandler(normlizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
|
||||
const ctrlValue = this.creditSalaryForm.value.date!;
|
||||
const ctrlValue = this.creditSalaryForm.value.date ?? moment();
|
||||
ctrlValue.month(normlizedMonth.month());
|
||||
ctrlValue.date(ctrlValue.daysInMonth());
|
||||
this.creditSalaryForm.setValue({ date: ctrlValue });
|
||||
@@ -65,7 +65,7 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
creditSalary() {
|
||||
const date = this.creditSalaryForm.value.date!.format('DD-MMM-YYYY');
|
||||
const date = (this.creditSalaryForm.value.date ?? moment()).format('DD-MMM-YYYY');
|
||||
if (!date) {
|
||||
this.toaster.show('Danger', 'Please choose a valid date.');
|
||||
return;
|
||||
@@ -81,8 +81,10 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
attendanceRecordUrl() {
|
||||
const startDate = this.attendanceRecordForm.value.startDate!.format('DD-MMM-YYYY');
|
||||
const finishDate = this.attendanceRecordForm.value.finishDate!.format('DD-MMM-YYYY');
|
||||
const startDate = (this.attendanceRecordForm.value.startDate ?? moment()).format('DD-MMM-YYYY');
|
||||
const finishDate = (this.attendanceRecordForm.value.finishDate ?? moment()).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
if (!startDate || !finishDate) {
|
||||
// this.toaster.show('Danger', 'Please choose a start and finish date.');
|
||||
return '';
|
||||
@@ -91,8 +93,10 @@ export class EmployeeFunctionsComponent {
|
||||
}
|
||||
|
||||
fingerPrintUrl() {
|
||||
const startDate = this.attendanceRecordForm.value.startDate!.format('DD-MMM-YYYY');
|
||||
const finishDate = this.attendanceRecordForm.value.finishDate!.format('DD-MMM-YYYY');
|
||||
const startDate = (this.attendanceRecordForm.value.startDate ?? moment()).format('DD-MMM-YYYY');
|
||||
const finishDate = (this.attendanceRecordForm.value.finishDate ?? moment()).format(
|
||||
'DD-MMM-YYYY',
|
||||
);
|
||||
if (!startDate || !finishDate) {
|
||||
// this.toaster.show('Danger', 'Please choose a start and finish date.');
|
||||
return '';
|
||||
|
||||
Reference in New Issue
Block a user