Skip to content

Commit

Permalink
Merge pull request #7902 from michaelchadwick/normalize-date-display-…
Browse files Browse the repository at this point in the history
…for-sessions-list

normalize date display format for sessions list
  • Loading branch information
dartajax authored Jun 21, 2024
2 parents 3a0dfb8 + c19f8ae commit d4f5c41
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 59 deletions.
34 changes: 17 additions & 17 deletions packages/frontend/tests/acceptance/course/session/offerings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module('Acceptance | Session - Offerings', function (hooks) {
);
assert.strictEqual(
blocks[0].startTime,
'Starts: ' + DateTime.fromJSDate(this.offering1.startDate).toFormat('h:mm a'),
'Starts: ' + DateTime.fromJSDate(this.offering1.startDate).toFormat('hh:mm a'),
);
assert.strictEqual(
blocks[0].endTime,
Expand All @@ -134,7 +134,7 @@ module('Acceptance | Session - Offerings', function (hooks) {
);
assert.strictEqual(
blocks[1].startTime,
'Starts: ' + DateTime.fromJSDate(this.offering2.startDate).toFormat('h:mm a'),
'Starts: ' + DateTime.fromJSDate(this.offering2.startDate).toFormat('hh:mm a'),
);
assert.strictEqual(
blocks[1].endTime,
Expand All @@ -160,8 +160,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
month: 'long',
day: 'numeric',
weekday: 'long',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);

Expand Down Expand Up @@ -326,8 +326,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
assert.notOk(block.hasMultiDay);
assert.strictEqual(block.dayOfWeek, 'Sunday');
assert.strictEqual(block.dayOfMonth, 'September 11');
assert.strictEqual(block.startTime, 'Starts: 2:15 AM');
assert.strictEqual(block.endTime, 'Ends: 5:30 PM');
assert.strictEqual(block.startTime, 'Starts: 02:15 AM');
assert.strictEqual(block.endTime, 'Ends: 05:30 PM');
assert.strictEqual(block.timeBlockOfferings.offerings.length, 1);

assert.strictEqual(block.timeBlockOfferings.offerings[0].learnerGroups.length, 2);
Expand Down Expand Up @@ -381,8 +381,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
month: 'long',
day: 'numeric',
weekday: 'long',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
assert.strictEqual(
Expand All @@ -392,8 +392,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
month: 'long',
day: 'numeric',
weekday: 'long',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
assert.strictEqual(block.timeBlockOfferings.offerings.length, 1);
Expand Down Expand Up @@ -439,8 +439,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
assert.notOk(block.hasMultiDay);
assert.strictEqual(block.dayOfWeek, 'Sunday');
assert.strictEqual(block.dayOfMonth, 'September 11');
assert.strictEqual(block.startTime, 'Starts: 2:15 AM');
assert.strictEqual(block.endTime, 'Ends: 5:30 PM');
assert.strictEqual(block.startTime, 'Starts: 02:15 AM');
assert.strictEqual(block.endTime, 'Ends: 05:30 PM');
assert.strictEqual(block.timeBlockOfferings.offerings.length, 2);

assert.strictEqual(block.timeBlockOfferings.offerings[0].learnerGroups.length, 1);
Expand Down Expand Up @@ -511,7 +511,7 @@ module('Acceptance | Session - Offerings', function (hooks) {
assert.strictEqual(block.dayOfWeek, 'Wednesday');
assert.strictEqual(block.dayOfMonth, 'October 5');
assert.strictEqual(block.startTime, 'Starts: 11:45 AM');
assert.strictEqual(block.endTime, 'Ends: 5:55 PM');
assert.strictEqual(block.endTime, 'Ends: 05:55 PM');
assert.strictEqual(block.timeBlockOfferings.offerings.length, 1);

const offering = block.timeBlockOfferings.offerings[0];
Expand Down Expand Up @@ -563,8 +563,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
assert.ok(block.hasEndTime);
assert.notOk(block.hasMultiDay);
assert.strictEqual(block.dayOfWeek, 'Friday');
assert.strictEqual(block.startTime, 'Starts: 2:15 AM');
assert.strictEqual(block.endTime, 'Ends: 3:23 PM');
assert.strictEqual(block.startTime, 'Starts: 02:15 AM');
assert.strictEqual(block.endTime, 'Ends: 03:23 PM');
assert.strictEqual(block.timeBlockOfferings.offerings.length, 2);
assert.strictEqual(block.timeBlockOfferings.offerings[0].learnerGroups.length, 1);
assert.strictEqual(
Expand Down Expand Up @@ -640,8 +640,8 @@ module('Acceptance | Session - Offerings', function (hooks) {
assert.ok(block.hasEndTime);
assert.notOk(block.hasMultiDay);
assert.strictEqual(block.dayOfWeek, 'Friday');
assert.strictEqual(block.startTime, 'Starts: 2:15 AM');
assert.strictEqual(block.endTime, 'Ends: 3:23 PM');
assert.strictEqual(block.startTime, 'Starts: 02:15 AM');
assert.strictEqual(block.endTime, 'Ends: 03:23 PM');
assert.strictEqual(block.timeBlockOfferings.offerings.length, 1);
assert.strictEqual(block.timeBlockOfferings.offerings[0].learnerGroups.length, 2);
assert.strictEqual(block.timeBlockOfferings.offerings[0].location, 'Scottsdale Stadium');
Expand Down
32 changes: 16 additions & 16 deletions packages/frontend/tests/acceptance/course/session/overview-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ module('Acceptance | Session - Overview', function (hooks) {
assert.strictEqual(
page.details.overview.ilmDueDateAndTime.value,
this.intl.formatDate(ilmSession.dueDate, {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: '2-digit',
hour12: true,
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);

Expand Down Expand Up @@ -93,12 +93,12 @@ module('Acceptance | Session - Overview', function (hooks) {
assert.strictEqual(
page.details.overview.ilmDueDateAndTime.value,
this.intl.formatDate(DateTime.fromObject({ hour: 17, minute: 0 }).plus({ weeks: 6 }), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: '2-digit',
hour12: true,
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
});
Expand Down Expand Up @@ -147,12 +147,12 @@ module('Acceptance | Session - Overview', function (hooks) {
assert.strictEqual(
page.details.overview.ilmDueDateAndTime.value,
this.intl.formatDate(ilmSession.dueDate, {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: '2-digit',
hour12: true,
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
await page.details.overview.ilmDueDateAndTime.edit();
Expand All @@ -165,12 +165,12 @@ module('Acceptance | Session - Overview', function (hooks) {
assert.strictEqual(
page.details.overview.ilmDueDateAndTime.value,
this.intl.formatDate(newDate.toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: '2-digit',
hour12: true,
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
});
Expand Down
8 changes: 4 additions & 4 deletions packages/frontend/tests/acceptance/course/sessionlist-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,19 @@ module('Acceptance | Course - Session List', function (hooks) {
assert.strictEqual(offerings.dates[2].dayOfMonth, offering3StartDate.toFormat('MMMM d'));

assert.strictEqual(offerings.offerings.length, 3);
assert.strictEqual(offerings.offerings[0].startTime, offering1StartDate.toFormat('h:mm a'));
assert.strictEqual(offerings.offerings[0].startTime, offering1StartDate.toFormat('hh:mm a'));
assert.strictEqual(offerings.offerings[0].location, 'room 0');
assert.strictEqual(offerings.offerings[0].learners, '(2) 1 guy M. Mc1son, 2 guy...');
assert.strictEqual(offerings.offerings[0].learnerGroups, '(2) learner group 0, learn...');
assert.strictEqual(offerings.offerings[0].instructors, '(3) 3 guy M. Mc3son, 4 guy...');

assert.strictEqual(offerings.offerings[1].startTime, offering2StartDate.toFormat('h:mm a'));
assert.strictEqual(offerings.offerings[1].startTime, offering2StartDate.toFormat('hh:mm a'));
assert.strictEqual(offerings.offerings[1].location, 'room 1');
assert.strictEqual(offerings.offerings[1].learners, '');
assert.strictEqual(offerings.offerings[1].learnerGroups, '');
assert.strictEqual(offerings.offerings[1].instructors, '');

assert.strictEqual(offerings.offerings[2].startTime, offering3StartDate.toFormat('h:mm a'));
assert.strictEqual(offerings.offerings[2].startTime, offering3StartDate.toFormat('hh:mm a'));
assert.strictEqual(offerings.offerings[2].location, 'room 2');
assert.strictEqual(offerings.offerings[2].learners, '');
assert.strictEqual(offerings.offerings[2].learnerGroups, '');
Expand Down Expand Up @@ -216,7 +216,7 @@ module('Acceptance | Course - Session List', function (hooks) {
await sessions[0].row.expand();
assert.strictEqual(
expandedSessions[0].lastUpdated,
'Last Update Last Update: 7/9/2019, 5:00 PM',
'Last Update Last Update: 07/09/2019, 05:00 PM',
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
<label class="offering-block-time-time-starts-label">
{{t "general.starts"}}:
</label>
{{format-date offeringTimeBlock.startDate weekday="long" month="long" day="numeric" hour="numeric" minute="numeric"}}
{{format-date offeringTimeBlock.startDate weekday="long" month="long" day="numeric" hour="2-digit" minute="2-digit"}}
</div>
<div class="offering-block-time-time-ends">
<label class="offering-block-time-time-ends-label">
{{t "general.ends"}}:
</label>
{{format-date offeringTimeBlock.endDate weekday="long" month="long" day="numeric" hour="numeric" minute="numeric"}}
{{format-date offeringTimeBlock.endDate weekday="long" month="long" day="numeric" hour="2-digit" minute="2-digit"}}
</div>
</div>
{{else}}
Expand All @@ -37,13 +37,13 @@
<label class="offering-block-time-time-starttime-label">
{{t "general.starts"}}:
</label>
{{format-date offeringTimeBlock.startDate hour="numeric" minute="numeric"}}
{{format-date offeringTimeBlock.startDate hour="2-digit" minute="2-digit"}}
</span>
<span class="offering-block-time-time-endtime">
<label class="offering-block-time-time-endtime-label">
{{t "general.ends"}}:
</label>
{{format-date offeringTimeBlock.endDate hour="numeric" minute="numeric"}}
{{format-date offeringTimeBlock.endDate hour="2-digit" minute="2-digit"}}
</span>
</div>
{{/if}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{{#if @ilmSession}}
{{#if @editable}}
<EditableField
@value={{format-date @ilmSession.dueDate month="numeric" day="numeric" year="2-digit" hour12=true hour="numeric" minute="numeric"}}
@value={{format-date @ilmSession.dueDate month="2-digit" day="2-digit" year="2-digit" hour12=true hour="2-digit" minute="2-digit"}}
@save={{perform this.save}}
@close={{this.revert}}
>
Expand All @@ -20,7 +20,7 @@
<ValidationError @errors={{get-errors-for this.dueDate}} />
</EditableField>
{{else}}
{{format-date @ilmSession.dueDate month="numeric" day="numeric" year="2-digit" hour12=true hour="numeric" minute="numeric"}}
{{format-date @ilmSession.dueDate month="2-digit" day="2-digit" year="2-digit" hour12=true hour="2-digit" minute="2-digit"}}
{{/if}}
{{/if}}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
>
{{#if postrequisite.firstOfferingDate}}
{{#if postrequisite.ilmSession}}
<strong>{{t "general.ilm"}}: {{t "general.dueBy"}}</strong> {{format-date postrequisite.firstOfferingDate}}
<strong>{{t "general.ilm"}}: {{t "general.dueBy"}}</strong> {{format-date postrequisite.firstOfferingDate month="2-digit" day="2-digit" year="numeric"}}
{{else}}
{{format-date postrequisite.firstOfferingDate month="numeric" day="numeric" year="numeric" hour12=true hour="numeric" minute="numeric"}}
{{format-date postrequisite.firstOfferingDate month="2-digit" day="2-digit" year="numeric" hour12=true hour="2-digit" minute="2-digit"}}
{{/if}}
{{/if}}
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="sessions-grid-last-updated">
<FaIcon @icon="clock-rotate-left" @title={{t "general.lastUpdate"}} />
{{t "general.lastUpdate"}}:
{{format-date @session.updatedAt month="numeric" day="numeric" year="numeric" hour="numeric" minute="numeric"}}
{{format-date @session.updatedAt month="2-digit" day="2-digit" year="numeric" hour="2-digit" minute="2-digit"}}
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{random 1 99}}
</span>
<span class="session-grid-first-offering">
{{format-date this.now}}
{{format-date this.now day="2-digit" month="2-digit" year="numeric" hour12=true hour="2-digit" minute="2-digit"}}
</span>
<span class="session-grid-offerings">
{{random 1 99}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@firstRow={{eq index 0}}
@even={{eq (mod index 2) 1}}
@span={{this.sortedOfferings.length}}
@startTime={{format-date @offeringTimeBlock.startDate hour="numeric" minute="numeric"}}
@startTime={{format-date @offeringTimeBlock.startDate hour="2-digit" minute="2-digit"}}
@durationHours={{@offeringTimeBlock.durationHours}}
@durationMinutes={{@offeringTimeBlock.durationMinutes}}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks

assert.ok(component.isVisible);
assert.strictEqual(component.label, 'Due By:');
assert.strictEqual(component.value, '5/19/21, 11:55 PM');
assert.strictEqual(component.value, '05/19/21, 11:55 PM');
assert.ok(component.isEditable);
await a11yAudit(this.element);
assert.ok(true, 'not a11y violations');
Expand All @@ -45,7 +45,7 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks
`);

assert.strictEqual(component.label, 'Due By:');
assert.strictEqual(component.value, '5/19/21, 11:55 PM');
assert.strictEqual(component.value, '05/19/21, 11:55 PM');
assert.notOk(component.isEditable);
await a11yAudit(this.element);
assert.ok(true, 'not a11y violations');
Expand All @@ -58,9 +58,9 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks
@ilmSession={{this.ilmSession}}
@editable={{this.editable}}
/>
`);
`);

assert.strictEqual(component.value, '5/19/21, 11:55 PM');
assert.strictEqual(component.value, '05/19/21, 11:55 PM');
await component.edit();
assert.strictEqual(component.datePicker.value, '5/19/2021');
assert.strictEqual(component.timePicker.hour.value, '11');
Expand All @@ -71,7 +71,7 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks
await component.timePicker.minute.select('23');
await component.timePicker.ampm.select('AM');
await component.save();
assert.strictEqual(component.value, '1/1/99, 5:23 AM');
assert.strictEqual(component.value, '01/01/99, 05:23 AM');
});

test('change date and time, then cancel', async function (assert) {
Expand All @@ -83,7 +83,7 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks
/>
`);

assert.strictEqual(component.value, '5/19/21, 11:55 PM');
assert.strictEqual(component.value, '05/19/21, 11:55 PM');
await component.edit();
assert.strictEqual(component.datePicker.value, '5/19/2021');
assert.strictEqual(component.timePicker.hour.value, '11');
Expand All @@ -94,6 +94,6 @@ module('Integration | Component | session-overview-ilm-duedate', function (hooks
await component.timePicker.minute.select('23');
await component.timePicker.ampm.select('AM');
await component.cancel();
assert.strictEqual(component.value, '5/19/21, 11:55 PM');
assert.strictEqual(component.value, '05/19/21, 11:55 PM');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ module('Integration | Component | sessions-grid-last-updated', function (hooks)
`);
const lastUpdatedText = () => {
const date = this.intl.formatDate(session.updatedAt, {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
});

const text = this.intl.t('general.lastUpdate');
Expand Down

0 comments on commit d4f5c41

Please sign in to comment.