Skip to content

Commit

Permalink
Update date and time functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mearman committed Feb 6, 2024
1 parent 16ecb88 commit e92ddd4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions .github/scripts/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28587,7 +28587,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generationVersion = exports.runNumber = exports.runId = void 0;
const github = __importStar(__nccwpck_require__(5438));
const getDate_1 = __nccwpck_require__(2125);
const getTime_1 = __nccwpck_require__(9967);
const getHMS_1 = __nccwpck_require__(644);
/**
* A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run.
*/
Expand All @@ -28600,7 +28600,7 @@ function generationVersion() {
const now = new Date();
const timestamp = now.getTime();
if (!exports.runId || !exports.runNumber) {
return `0.0.0-${(0, getDate_1.getDate)(now)}.${(0, getTime_1.getTime)(now)}`;
return `0.0.0-${(0, getDate_1.getYMD)(now)}.${(0, getHMS_1.getHMS)(now)}`;
}
else {
return `0.0.0-${exports.runId}.${exports.runNumber}.${timestamp}`;
Expand All @@ -28617,28 +28617,28 @@ exports.generationVersion = generationVersion;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getDate = void 0;
function getDate(now) {
exports.getYMD = void 0;
function getYMD(now) {
const month = String(now.getMonth() + 1).padStart(2, '0');
const date = String(now.getDate()).padStart(2, '0');
return `${now.getFullYear()}${month}${date}`;
}
exports.getDate = getDate;
exports.getYMD = getYMD;


/***/ }),

/***/ 9967:
/***/ 644:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getTime = void 0;
function getTime(now) {
exports.getHMS = void 0;
function getHMS(now) {
return `${now.getHours().toString().padStart(2, '0')}${now.getMinutes().toString().padStart(2, '0')}${now.getSeconds().toString().padStart(2, '0')}`;
}
exports.getTime = getTime;
exports.getHMS = getHMS;


/***/ }),
Expand Down
6 changes: 3 additions & 3 deletions .github/scripts/src/generationVersion.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as github from "@actions/github";
import { getDate } from "./getDate";
import { getTime } from "./getTime";
import { getYMD } from "./getDate";
import { getHMS } from "./getHMS";

/**
* A unique number for each workflow run within a repository. This number does not change if you re-run the workflow run.
Expand All @@ -17,7 +17,7 @@ export function generationVersion() {
const timestamp = now.getTime();

if (!runId || !runNumber) {
return `0.0.0-${getDate(now)}.${getTime(now)}`;
return `0.0.0-${getYMD(now)}.${getHMS(now)}`;
} else {
return `0.0.0-${runId}.${runNumber}.${timestamp}`;
}
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/src/getDate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function getDate(now: Date): string {
export function getYMD(now: Date): string {
const month = String(now.getMonth() + 1).padStart(2, '0');
const date = String(now.getDate()).padStart(2, '0');
return `${now.getFullYear()}${month}${date}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function getTime(now: Date): string {
export function getHMS(now: Date): string {
return `${now.getHours().toString().padStart(2, '0')}${now.getMinutes().toString().padStart(2, '0')}${now.getSeconds().toString().padStart(2, '0')}`;
}

0 comments on commit e92ddd4

Please sign in to comment.