Skip to content

Commit 0443a7a

Browse files
Merge pull request #1260 from opencomponents/remove-pad-zero
[INTERNAL] Remove pad-zero util
2 parents 2b9ba3f + b76c7aa commit 0443a7a

File tree

3 files changed

+8
-36
lines changed

3 files changed

+8
-36
lines changed

src/utils/date-stringify.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import padZero from './pad-zero';
1+
function padTwoDigits(data: number): string {
2+
return String(data).padStart(2, '0');
3+
}
24

35
export default function dateStringify(date: unknown): string {
46
if (date instanceof Date) {
57
return (
68
date.getFullYear() +
79
'/' +
8-
padZero(2, date.getMonth() + 1) +
10+
padTwoDigits(date.getMonth() + 1) +
911
'/' +
10-
padZero(2, date.getDate()) +
12+
padTwoDigits(date.getDate()) +
1113
' ' +
12-
padZero(2, date.getHours()) +
14+
padTwoDigits(date.getHours()) +
1315
':' +
14-
padZero(2, date.getMinutes()) +
16+
padTwoDigits(date.getMinutes()) +
1517
':' +
16-
padZero(2, date.getSeconds())
18+
padTwoDigits(date.getSeconds())
1719
);
1820
}
1921

src/utils/pad-zero.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/unit/utils-pad-zero.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)