Skip to content

Commit

Permalink
test(stark-ui): fix test in starkTimestampMask directive when date is…
Browse files Browse the repository at this point in the history
… '29-02'
  • Loading branch information
SuperITMan committed Jan 8, 2020
1 parent 48fdbb8 commit 7b2352b
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,16 @@ describe("createTimestampPipe", () => {
assertTimestampsValidity(invalidDateTimeStrings, false, fullDateTimeShortYearFormat);
});

it("should return FALSE if 29 February is given and the format given has no year", () => {
// it is invalid because when there is no year specified, it is assumed to be something recurrent
// and you shouldn't put something recurrent on a Feb 29!
it("should return FALSE if 29 February is given and the format given has no year and current year is NOT leap", () => {
const isALeapYear = new Date().getFullYear() % 4 === 0;

let invalidDateTimeStrings = ["29-02"];

assertTimestampsValidity(invalidDateTimeStrings, false, "DD-MM");
assertTimestampsValidity(invalidDateTimeStrings, isALeapYear, "DD-MM");

invalidDateTimeStrings = ["02-29"];

assertTimestampsValidity(invalidDateTimeStrings, false, "MM-DD");
assertTimestampsValidity(invalidDateTimeStrings, isALeapYear, "MM-DD");
});

it("should return FALSE if the date time string doesn't match the format", () => {
Expand Down

0 comments on commit 7b2352b

Please sign in to comment.