FEATURE: Omit showing day when 'to' day is same as 'from' day (#18500)

Essentially,

Saturday at 2:50 PM -> Saturday at 4:38 PM becomes
Saturday at 2:50 PM -> 4:38 PM (Singapore)

Also, the displayed dates are shortened when the standalone date
is within two days. So despite the 'from' and 'to' date being the
same day, it may show 'Saturday' for 'from', and the specific date
for the 'to'. This corrects the behaviour.

(so if the current date and time is Thursday 5PM, the 'from' date
below is within 2 days, but the 'to' date is not)
Saturday at 2:50 PM -> 8 October 2022 at 9:38 PM becomes
Saturday at 2:50 PM -> 9:38 PM
This commit is contained in:
Natalie Tay
2022-10-07 09:39:41 +08:00
committed by GitHub
parent cb26d52d33
commit 7d8cda9858
5 changed files with 61 additions and 7 deletions

View File

@ -86,6 +86,20 @@ module("lib:local-date-builder", function () {
);
});
test("time", function (assert) {
assert.buildsCorrectDate(
{
"time": "12:22:00",
"date": "2022-10-07",
"timezone": "Asia/Singapore",
"localTimezone": "Asia/Singapore",
"sameLocalDayAsFrom": true
},
{ formatted: "12:22 PM (Singapore)" },
"it displays the time only as the date is the same local day as 'from'"
);
});
test("option[format]", function (assert) {
freezeTime({ date: "2020-03-11" }, () => {
assert.buildsCorrectDate(