Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: TT-167 Date picker disable future dates
  • Loading branch information
wobravo committed Mar 4, 2021
commit 056439eaac099c58ee5e88636354013cc09b7c50
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
[class.is-invalid]="start_date.invalid && start_date.touched"
required
(ngModelChange)="onStartDateChange($event)"
[max]="getActualDate()"
[max]="getCurrentDate()"
onkeydown="return false"
/>
</div>
Expand Down Expand Up @@ -120,7 +120,7 @@
aria-describedby="inputGroup-sizing-sm"
[class.is-invalid]="end_date.invalid && end_date.touched"
required
[max]="getActualDate()"
[max]="getCurrentDate()"
onkeydown="return false"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('DetailsFieldsComponent', () => {
it('on get actual date should return the current date', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should update the references and the name of the test. Something like:
On get current date should return expected date

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actualDateExpected to expectedDate

const actualDateExpected = new Date().toISOString().split('T')[0];

expect(component.getActualDate()).toEqual(actualDateExpected);
expect(component.getCurrentDate()).toEqual(actualDateExpected);
});
/*
TODO As part of https://github.com/ioet/time-tracker-ui/issues/424 a new parameter was added to the details-field-component,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
this.selectedTechnologies = $event;
}

getActualDate(): string {
getCurrentDate(): string {
return new Date().toISOString().split('T')[0];
}

Expand Down