File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export async function bumpVersion(
69
69
const suffix =
70
70
typeof opts . suffix === "string"
71
71
? `-${ opts . suffix } `
72
- : `- ${ Math . round ( Date . now ( ) / 1000 ) } . ${ commits [ 0 ] . shortHash } ` ;
72
+ : `+ ${ fmtDate ( new Date ( ) ) } - ${ commits [ 0 ] . shortHash } ` ;
73
73
pkg . version = config . newVersion = config . newVersion . split ( "-" ) [ 0 ] + suffix ;
74
74
}
75
75
@@ -85,3 +85,14 @@ export async function bumpVersion(
85
85
86
86
return pkg . version ;
87
87
}
88
+
89
+ function fmtDate ( d : Date ) : string {
90
+ // YYMMDD-HHMMSS: 20240919-140954
91
+ const date = joinNumbers ( [ d . getFullYear ( ) , d . getMonth ( ) + 1 , d . getDate ( ) ] ) ;
92
+ const time = joinNumbers ( [ d . getHours ( ) , d . getMinutes ( ) , d . getSeconds ( ) ] ) ;
93
+ return `${ date } -${ time } ` ;
94
+ }
95
+
96
+ function joinNumbers ( items : number [ ] ) : string {
97
+ return items . map ( ( i ) => ( i + "" ) . padStart ( 2 , "0" ) ) . join ( "" ) ;
98
+ }
You can’t perform that action at this time.
0 commit comments