Skip to content

Commit

Permalink
fix bug & update to node16
Browse files Browse the repository at this point in the history
  • Loading branch information
ShotaKitazawa committed Feb 14, 2022
1 parent 1647ddd commit ef2f47a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ outputs:
new_version:
description: The bumped calver version.
runs:
using: node12
using: node16
main: dist/index.js
branding:
icon: bookmark
Expand Down
11 changes: 3 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1565,12 +1565,7 @@ class Calver {
this.year = year;
this.month = month;
this.index = Number(index);
if (currentVersion.startsWith('v')) {
this.hasVPrefix = true;
}
else {
this.hasVPrefix = false;
}
this.hasVPrefix = currentVersion.startsWith('v') ? true : false;
}
toString() {
let output = `${this.year}.${this.month}.${this.index}`;
Expand All @@ -1586,8 +1581,8 @@ class Calver {
this.index += 1;
}
else {
this.year = String('00' + now.getFullYear()).slice(-2);
this.month = String('00' + now.getMonth() + 1).slice(-2);
this.year = String(now.getFullYear()).slice(-2);
this.month = String('0' + (Number(now.getMonth()) + 1)).slice(-2);
this.index = 0;
}
return this;
Expand Down
10 changes: 3 additions & 7 deletions src/calver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ export class Calver {
this.year = year;
this.month = month;
this.index = Number(index);
if (currentVersion.startsWith('v')) {
this.hasVPrefix = true;
} else {
this.hasVPrefix = false;
}
this.hasVPrefix = currentVersion.startsWith('v') ? true : false;
}

toString(): string {
Expand All @@ -42,8 +38,8 @@ export class Calver {
) {
this.index += 1;
} else {
this.year = String('00' + now.getFullYear()).slice(-2);
this.month = String('00' + (now.getMonth() + 1)).slice(-2);
this.year = String(now.getFullYear()).slice(-2);
this.month = String('0' + (Number(now.getMonth()) + 1)).slice(-2);
this.index = 0;
}
return this;
Expand Down

0 comments on commit ef2f47a

Please sign in to comment.