Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize date format displays in Curriculum Inventory Reports #7877

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
colspan="2"
data-test-start-date
>
{{format-date @report.startDate}}
{{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}}
</td>
<td
class="text-center hide-from-small-screen"
colspan="2"
data-test-end-date
>
{{format-date @report.endDate}}
{{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}}
</td>
<td
class="text-center"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<span>
{{#if @canUpdate}}
<EditableField
@value={{format-date @report.startDate}}
@value={{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}}
@save={{perform this.changeStartDate}}
@close={{this.revertStartDateChanges}}
>
Expand All @@ -60,7 +60,7 @@
<ValidationError @errors={{get-errors-for this.startDate}} />
</EditableField>
{{else}}
{{format-date @report.startDate}}
{{format-date @report.startDate day="2-digit" month="2-digit" year="numeric"}}
{{/if}}
</span>
</div>
Expand All @@ -71,7 +71,7 @@
<span>
{{#if @canUpdate}}
<EditableField
@value={{format-date @report.endDate}}
@value={{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}}
@save={{perform this.changeEndDate}}
@close={{this.revertEndDateChanges}}
>
Expand All @@ -83,7 +83,7 @@
<ValidationError @errors={{get-errors-for this.endDate}} />
</EditableField>
{{else}}
{{format-date @report.endDate}}
{{format-date @report.endDate day="2-digit" month="2-digit" year="numeric"}}
{{/if}}
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
</td>
<td class="text-center hide-from-small-screen" colspan="2" data-test-start-date>
{{#if @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.notApplicableAbbr"}}
{{/if}}
</td>
<td class="text-center hide-from-small-screen" colspan="2" data-test-end-date>
{{#if @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.notApplicableAbbr"}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
{{#if this.course}}
<span class="details" data-test-course-details>
{{t "general.level"}}: {{this.course.level}},
{{t "general.startDate"}}: {{format-date this.course.startDate}},
{{t "general.endDate"}}: {{format-date this.course.endDate}}
{{t "general.startDate"}}: {{format-date this.course.startDate day="2-digit" month="2-digit" year="numeric"}},
{{t "general.endDate"}}: {{format-date this.course.endDate day="2-digit" month="2-digit" year="numeric"}}
{{#if this.course.clerkshipType}}
- {{t "general.clerkship"}} ({{this.course.clerkshipType.title}})
{{/if}}
Expand Down Expand Up @@ -176,15 +176,15 @@
{{on "click" (set this.isEditingDatesAndDuration true)}}
>
{{#if @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.clickToEdit"}}
{{/if}}
</button>
{{else}}
<span>
{{#if @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate}}
{{format-date @sequenceBlock.startDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.notApplicableAbbr"}}
{{/if}}
Expand All @@ -201,15 +201,15 @@
{{on "click" (set this.isEditingDatesAndDuration true)}}
>
{{#if @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.clickToEdit"}}
{{/if}}
</button>
{{else}}
<span>
{{#if @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate}}
{{format-date @sequenceBlock.endDate day="2-digit" month="2-digit" year="numeric"}}
{{else}}
{{t "general.notApplicableAbbr"}}
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,22 @@ module('Integration | Component | curriculum-inventory/report-list-item', functi
assert.strictEqual(component.name, 'CI Report');
assert.strictEqual(component.program, 'program 0');
assert.strictEqual(component.year, '2017');
assert.strictEqual(component.startDate, this.intl.formatDate(this.report.startDate));
assert.strictEqual(component.endDate, this.intl.formatDate(this.report.endDate));
assert.strictEqual(
component.startDate,
this.intl.formatDate(this.report.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.endDate,
this.intl.formatDate(this.report.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.status, 'Draft');
assert.ok(component.isDeletable);
assert.notOk(component.confirmRemoval.isVisible);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,20 @@ module('Integration | Component | curriculum-inventory/report-list', function (h
assert.strictEqual(component.reports[0].year, '2016', 'Academic year shows.');
assert.strictEqual(
component.reports[0].startDate,
this.intl.formatDate(reportModel2.startDate),
this.intl.formatDate(reportModel2.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date shows.',
);
assert.strictEqual(
component.reports[0].endDate,
this.intl.formatDate(reportModel2.endDate),
this.intl.formatDate(reportModel2.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date shows.',
);
assert.strictEqual(component.reports[0].status, 'Finalized', 'Status shows.');
Expand All @@ -110,12 +118,20 @@ module('Integration | Component | curriculum-inventory/report-list', function (h
assert.strictEqual(component.reports[1].year, '2017', 'Academic year shows.');
assert.strictEqual(
component.reports[1].startDate,
this.intl.formatDate(reportModel1.startDate),
this.intl.formatDate(reportModel1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date shows.',
);
assert.strictEqual(
component.reports[1].endDate,
this.intl.formatDate(reportModel1.endDate),
this.intl.formatDate(reportModel1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date shows.',
);
assert.strictEqual(component.reports[1].status, 'Draft', 'Status shows.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,21 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
assert.strictEqual(component.startDate.label, 'Start:', 'Start date label is correct.');
assert.strictEqual(
component.startDate.text,
this.intl.formatDate(reportModel.startDate),
this.intl.formatDate(reportModel.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date is visible.',
);
assert.strictEqual(component.endDate.label, 'End:', 'End date label is correct.');
assert.strictEqual(
component.endDate.text,
this.intl.formatDate(reportModel.endDate),
this.intl.formatDate(reportModel.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date is visible.',
);
assert.strictEqual(
Expand Down Expand Up @@ -101,12 +109,20 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
);
assert.strictEqual(
component.startDate.readOnlyText,
this.intl.formatDate(reportModel.startDate),
this.intl.formatDate(reportModel.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Start date is visible.',
);
assert.strictEqual(
component.endDate.readOnlyText,
this.intl.formatDate(reportModel.endDate),
this.intl.formatDate(reportModel.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'End date is visible.',
);
assert.strictEqual(
Expand Down Expand Up @@ -203,7 +219,11 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
await component.startDate.save();
assert.strictEqual(
component.startDate.text,
this.intl.formatDate(newVal),
this.intl.formatDate(newVal, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Edit link shown new start date post-update.',
);
assert.strictEqual(
Expand Down Expand Up @@ -248,7 +268,11 @@ module('Integration | Component | curriculum-inventory/report-overview', functio
await component.endDate.save();
assert.strictEqual(
component.endDate.text,
this.intl.formatDate(newVal),
this.intl.formatDate(newVal, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
'Edit link shown new end date post-update.',
);
assert.strictEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list-item'
assert.strictEqual(component.orderInSequence, '3');
assert.strictEqual(
component.startDate,
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 3, day: 17 }).toJSDate()),
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 3, day: 17 }).toJSDate(), {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.endDate,
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 5, day: 22 }).toJSDate()),
this.intl.formatDate(DateTime.fromObject({ year: 2021, month: 5, day: 22 }).toJSDate(), {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.course, 'course 0');
assert.ok(component.isDeletable);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list', fun
assert.strictEqual(component.list.items[1].orderInSequence, 'n/a');
assert.strictEqual(
component.list.items[1].startDate,
this.intl.formatDate(this.sequenceBlock1.startDate),
this.intl.formatDate(this.sequenceBlock1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.list.items[1].endDate,
this.intl.formatDate(this.sequenceBlock1.endDate),
this.intl.formatDate(this.sequenceBlock1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.list.items[1].course, this.course.title);
assert.ok(component.list.items[1].isDeletable);
Expand Down Expand Up @@ -190,11 +198,19 @@ module('Integration | Component | curriculum-inventory/sequence-block-list', fun
assert.strictEqual(component.list.items[1].orderInSequence, 'n/a');
assert.strictEqual(
component.list.items[1].startDate,
this.intl.formatDate(this.sequenceBlock1.startDate),
this.intl.formatDate(this.sequenceBlock1.startDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(
component.list.items[1].endDate,
this.intl.formatDate(this.sequenceBlock1.endDate),
this.intl.formatDate(this.sequenceBlock1.endDate, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
}),
);
assert.strictEqual(component.list.items[1].course, this.course.title);
assert.ok(component.list.items[1].isDeletable);
Expand Down
Loading