Skip to content

Commit

Permalink
3.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
elPandaFriki committed Feb 25, 2023
1 parent bf8761d commit cb2bd2c
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 9 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "portfolio",
"version": "3.0.5",
"date": "2023-02-25 21:59",
"version": "3.0.6",
"date": "25 Feb 2023 22:08",
"homepage": "https://elPandaFriki.github.io/portfolio",
"private": true,
"dependencies": {
Expand All @@ -28,9 +28,10 @@
"typescript": "^4.9.5"
},
"scripts": {
"fix_version": "npm run exec_update_version && prettier --loglevel silent --write -c package.json",
"exec_update_version": "ts-node --project ./scripts/tsconfig.json scripts/update_version.ts",
"exec_commit_version": "ts-node --project ./scripts/tsconfig.json scripts/commit_version.ts",
"update-version": "npm run exec_update_version && prettier --loglevel silent --write -c package.json && npm run exec_commit_version",
"update-version": "npm run fix_version && npm run exec_commit_version",
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "react-scripts start",
"build": "react-scripts build",
Expand Down
59 changes: 53 additions & 6 deletions scripts/update_version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,61 @@ function padStart(text: number | string, length: number, chars: string): string
function getUniversalString(): string {
const date = new Date();
const getDate = () => {
const yearString = `${date.getUTCFullYear()}`;
const monthString = `${padStart(date.getUTCMonth() + 1, 2, '0')}`;
const dayString = `${padStart(date.getUTCDate(), 2, '0')}`;
return `${yearString}-${monthString}-${dayString}`;
const year = date.getUTCFullYear();
const month = date.getUTCMonth();
const day = date.getUTCDate();
const yearString = padStart(year, 4, '0');
// const monthString = `${padStart(month + 1, 2, '0')}`;
const getMonthName = () => {
switch (month) {
case 0: {
return 'January';
}
case 1: {
return 'February';
}
case 2: {
return 'March';
}
case 3: {
return 'April';
}
case 4: {
return 'May';
}
case 5: {
return 'June';
}
case 6: {
return 'July';
}
case 7: {
return 'August';
}
case 8: {
return 'September';
}
case 9: {
return 'October';
}
case 10: {
return 'November';
}
case 11: {
return 'December';
}
}
return '';
};
const monthString = getMonthName().substring(0, 3);
const dayString = padStart(day, 2, '0');
return `${dayString} ${monthString} ${yearString}`;
};
const getTime = () => {
const hourString = `${padStart(date.getUTCHours(), 2, '0')}`;
const minutesString = `${padStart(date.getUTCMinutes(), 2, '0')}`;
const hours = date.getUTCHours();
const minutes = date.getUTCMinutes();
const hourString = padStart(hours, 2, '0');
const minutesString = padStart(minutes, 2, '0');
return `${hourString}:${minutesString}`;
};
return `${getDate()} ${getTime()}`;
Expand Down

0 comments on commit cb2bd2c

Please sign in to comment.