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 display format for offering form #7898

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
2 changes: 1 addition & 1 deletion packages/ilios-common/addon/components/offering-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</label>
{{#if this.endDate}}
<div class="text">
{{format-date this.endDate month="numeric" day="numeric" year="numeric" hour="numeric" minute="numeric"}}
{{format-date this.endDate month="2-digit" day="2-digit" year="numeric" hour="2-digit" minute="2-digit"}}
</div>
{{/if}}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,22 @@ module('Integration | Component | offering form', function (hooks) {
const newStartDate = DateTime.fromObject({ hour: 9 }).plus({ days: 1 });
assert.strictEqual(
this.intl.formatDate(DateTime.fromObject({ hour: 9, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
await component.startDate.datePicker.set(newStartDate.toJSDate());
assert.strictEqual(
this.intl.formatDate(newStartDate.set({ hour: 9, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
Expand All @@ -410,11 +410,11 @@ module('Integration | Component | offering form', function (hooks) {
assert.strictEqual(
component.endDate.value,
this.intl.formatDate(DateTime.fromObject({ hour: 9, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
await component.startTime.timePicker.hour.select('2');
Expand All @@ -423,11 +423,11 @@ module('Integration | Component | offering form', function (hooks) {
assert.strictEqual(
component.endDate.value,
this.intl.formatDate(DateTime.fromObject({ hour: 15, minute: 15 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
);
});
Expand All @@ -437,23 +437,23 @@ module('Integration | Component | offering form', function (hooks) {
`);
assert.strictEqual(
this.intl.formatDate(DateTime.fromObject({ hour: 9, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
await component.duration.hours.set('2');
await component.duration.minutes.set('15');
assert.strictEqual(
this.intl.formatDate(DateTime.fromObject({ hour: 10, minute: 15 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
Expand All @@ -465,11 +465,11 @@ module('Integration | Component | offering form', function (hooks) {
`);
assert.strictEqual(
this.intl.formatDate(DateTime.fromObject({ hour: 9, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
Expand All @@ -480,11 +480,11 @@ module('Integration | Component | offering form', function (hooks) {
await component.duration.minutes.set('50');
assert.strictEqual(
this.intl.formatDate(DateTime.fromObject({ hour: 17, minute: 0 }).toJSDate(), {
month: 'numeric',
day: 'numeric',
month: '2-digit',
day: '2-digit',
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
hour: '2-digit',
minute: '2-digit',
}),
component.endDate.value,
);
Expand Down