1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-07-30 02:21:17 +03:00

Prevent future date selection in jump to date (#10419)

You can still type in whatever date you want (native date input behavior) but the UI picker has future dates disabled.

Fix https://github.com/vector-im/element-web/issues/20800
This commit is contained in:
Eric Eastwood
2023-03-22 11:45:44 -05:00
committed by GitHub
parent 3eb6a55b93
commit ed88e0cdce
5 changed files with 113 additions and 5 deletions

View File

@ -19,6 +19,7 @@ import {
formatRelativeTime,
formatDuration,
formatFullDateNoDayISO,
formatDateForInput,
formatTimeLeft,
formatPreciseDuration,
formatLocalDateShort,
@ -126,6 +127,15 @@ describe("formatFullDateNoDayISO", () => {
});
});
describe("formatDateForInput", () => {
it.each([["1993-11-01"], ["1066-10-14"], ["0571-04-22"], ["0062-02-05"]])(
"should format %s",
(dateString: string) => {
expect(formatDateForInput(new Date(dateString))).toBe(dateString);
},
);
});
describe("formatTimeLeft", () => {
it.each([
[0, "0s left"],