Skip to content

Commit af83f09

Browse files
committed
Version Formatting for convinience
1 parent 0d8a155 commit af83f09

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/components/AppBar/index.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,22 @@ export function AppBar() {
1111
}>({});
1212

1313
const showVersions = useCallback(() => {
14+
const convertVersion = (v: string): string => {
15+
const timestamp: string = v.split("v")[1];
16+
const date: Date = new Date(Number(timestamp));
17+
18+
const year: string = (date.getFullYear()).toString().padStart(4, "0");
19+
const month: string = (date.getMonth() + 1).toString().padStart(2, "0");
20+
const day: string = (date.getDate()).toString().padStart(2, "0");
21+
const hours: string = (date.getHours()).toString().padStart(2, "0");
22+
const minutes: string = (date.getMinutes()).toString().padStart(2, "0");
23+
const seconds: string = (date.getSeconds()).toString().padStart(2, "0");
24+
25+
return `v${year}.${month}.${day}.${hours}${minutes}${seconds}`;
26+
};
27+
1428
const versionMessage = Object.entries(version).map(
15-
v => `${v[0]}: ${v[1]}`
29+
v => `${v[0]}: ${convertVersion(v[1])}`
1630
).join("\n");
1731

1832
alert(versionMessage);

0 commit comments

Comments
 (0)