Skip to content

Commit

Permalink
Merge pull request #1260 from opencomponents/remove-pad-zero
Browse files Browse the repository at this point in the history
[INTERNAL] Remove pad-zero util
  • Loading branch information
ricardo-devis-agullo authored Oct 22, 2021
2 parents 2b9ba3f + b76c7aa commit 0443a7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
14 changes: 8 additions & 6 deletions src/utils/date-stringify.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import padZero from './pad-zero';
function padTwoDigits(data: number): string {
return String(data).padStart(2, '0');
}

export default function dateStringify(date: unknown): string {
if (date instanceof Date) {
return (
date.getFullYear() +
'/' +
padZero(2, date.getMonth() + 1) +
padTwoDigits(date.getMonth() + 1) +
'/' +
padZero(2, date.getDate()) +
padTwoDigits(date.getDate()) +
' ' +
padZero(2, date.getHours()) +
padTwoDigits(date.getHours()) +
':' +
padZero(2, date.getMinutes()) +
padTwoDigits(date.getMinutes()) +
':' +
padZero(2, date.getSeconds())
padTwoDigits(date.getSeconds())
);
}

Expand Down
3 changes: 0 additions & 3 deletions src/utils/pad-zero.ts

This file was deleted.

27 changes: 0 additions & 27 deletions test/unit/utils-pad-zero.js

This file was deleted.

0 comments on commit 0443a7a

Please sign in to comment.