-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct handling of day in date
- Loading branch information
Askestad
authored and
Askestad
committed
Nov 7, 2019
1 parent
39794c0
commit af95839
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { padWithLeadingZero } from "./pad-with-leading-zero"; | ||
|
||
describe("Pad with leading zero", () => { | ||
it("should pad a single digit with a leading zero", () => { | ||
expect(padWithLeadingZero(4)).toBe("04"); | ||
}); | ||
|
||
it("should not pad a double digit number", () => { | ||
expect(padWithLeadingZero(14)).toBe("14"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export function padWithLeadingZero(n: number) { | ||
const retval = `0${n}`; | ||
return retval.slice(-2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters