Skip to content

Commit 3a18f2d

Browse files
committed
fix: change default calendarVersioning format to YYYY.MM0D.MICRO
1 parent d973d9c commit 3a18f2d

3 files changed

Lines changed: 15 additions & 23 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ This allows managing multiple modules with independent versioning in a single re
163163

164164
### tagpr.calendarVersioning (Optional)
165165
Use Calendar Versioning (CalVer) instead of Semantic Versioning.
166-
Set to `true` to use the default format (`YYYY.MMDD.MICRO`), or specify a custom format string directly.
166+
Set to `true` to use the default format (`YYYY.MM0D.MICRO`), or specify a custom format string directly.
167167
Labels for major/minor are ignored when this option is enabled.
168168

169169
Available format tokens (see https://calver.org):
@@ -174,7 +174,7 @@ Available format tokens (see https://calver.org):
174174
- Micro: `MICRO` (auto-incrementing patch number for same date)
175175

176176
Examples:
177-
- `true` or `"YYYY.MMDD.MICRO"` → `v2026.123.0` (Dec 3rd, 2026)
177+
- `true` or `"YYYY.MM0D.MICRO"` → `v2026.1203.0` (Dec 3rd, 2026)
178178
- `"YYYY.0M.MICRO"` → `v2026.01.0`
179179
- `"YY.0M0D.MICRO"` → `v26.0123.0`
180180

calver_test.go

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestNewCalver(t *testing.T) {
3939
now: time.Date(2026, 2, 1, 0, 0, 0, 0, time.UTC),
4040
vPrefix: false,
4141
format: defaultCalendarVersioningFormat,
42-
want: "2026.21.0",
42+
want: "2026.201.0",
4343
},
4444
{
4545
name: "YYYY.0M.MICRO format",
@@ -82,23 +82,23 @@ func TestNextCalver(t *testing.T) {
8282
{
8383
name: "same date increments patch",
8484
current: "v2026.123.0",
85-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
85+
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
8686
vPrefix: true,
8787
format: defaultCalendarVersioningFormat,
8888
want: "v2026.123.1",
8989
},
9090
{
9191
name: "same date increments patch multiple times",
9292
current: "v2026.123.5",
93-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
93+
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
9494
vPrefix: true,
9595
format: defaultCalendarVersioningFormat,
9696
want: "v2026.123.6",
9797
},
9898
{
9999
name: "different day resets patch",
100100
current: "v2026.123.5",
101-
now: time.Date(2026, 12, 4, 0, 0, 0, 0, time.UTC),
101+
now: time.Date(2026, 1, 24, 0, 0, 0, 0, time.UTC),
102102
vPrefix: true,
103103
format: defaultCalendarVersioningFormat,
104104
want: "v2026.124.0",
@@ -109,30 +109,22 @@ func TestNextCalver(t *testing.T) {
109109
now: time.Date(2026, 2, 1, 0, 0, 0, 0, time.UTC),
110110
vPrefix: true,
111111
format: defaultCalendarVersioningFormat,
112-
want: "v2026.21.0",
112+
want: "v2026.201.0",
113113
},
114114
{
115115
name: "different year resets patch",
116116
current: "v2025.1231.9",
117117
now: time.Date(2026, 1, 1, 0, 0, 0, 0, time.UTC),
118118
vPrefix: true,
119119
format: defaultCalendarVersioningFormat,
120-
want: "v2026.11.0",
120+
want: "v2026.101.0",
121121
},
122122
{
123123
name: "without v prefix",
124124
current: "2026.123.0",
125-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
126-
vPrefix: false,
127-
format: defaultCalendarVersioningFormat,
128-
want: "2026.123.1",
129-
},
130-
{
131-
name: "YYYY.MM0D.MICRO format same month",
132-
current: "2026.123.0",
133125
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
134126
vPrefix: false,
135-
format: "YYYY.MM0D.MICRO",
127+
format: defaultCalendarVersioningFormat,
136128
want: "2026.123.1",
137129
},
138130
{
@@ -194,21 +186,21 @@ func TestGuessNextWithCalver(t *testing.T) {
194186
name: "calver ignores major label",
195187
current: "v2026.123.0",
196188
labels: []string{"major"},
197-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
189+
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
198190
want: "v2026.123.1",
199191
},
200192
{
201193
name: "calver ignores minor label",
202194
current: "v2026.123.0",
203195
labels: []string{"minor"},
204-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
196+
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
205197
want: "v2026.123.1",
206198
},
207199
{
208200
name: "calver ignores all labels",
209201
current: "v2026.123.0",
210202
labels: []string{"major", "minor"},
211-
now: time.Date(2026, 12, 3, 12, 0, 0, 0, time.UTC),
203+
now: time.Date(2026, 1, 23, 12, 0, 0, 0, time.UTC),
212204
want: "v2026.123.1",
213205
},
214206
}

config.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ const (
7070
#
7171
# tagpr.calendarVersioning (Optional)
7272
# Use Calendar Versioning instead of Semantic Versioning.
73-
# Set to true for the default format (YYYY.MMDD.MICRO), or specify a custom format string.
73+
# Set to true for the default format (YYYY.MM0D.MICRO), or specify a custom format string.
7474
# Available tokens (see https://calver.org):
7575
# Year: YYYY (4-digit), YY (2-digit), 0Y (zero-padded 2-digit)
7676
# Month: MM (no padding), 0M (zero-padded)
7777
# Week: WW (no padding), 0W (zero-padded)
7878
# Day: DD (no padding), 0D (zero-padded)
7979
# Micro: MICRO (auto-incrementing patch number for same date)
8080
# Examples:
81-
# - true or "YYYY.MMDD.MICRO" -> 2026.123.0 (Dec 3)
81+
# - true or "YYYY.MM0D.MICRO" -> 2026.1203.0 (Dec 3)
8282
# - "YYYY.0M.MICRO" -> 2026.01.0
8383
# - "YY.0M0D.MICRO" -> 26.0123.0
8484
#
@@ -87,7 +87,7 @@ const (
8787
defaultMajorLabels = "major"
8888
defaultMinorLabels = "minor"
8989
defaultCommitPrefix = "[tagpr]"
90-
defaultCalendarVersioningFormat = "YYYY.MMDD.MICRO"
90+
defaultCalendarVersioningFormat = "YYYY.MM0D.MICRO"
9191
calverTrue = "true"
9292
calverFalse = "false"
9393
envConfigFile = "TAGPR_CONFIG_FILE"

0 commit comments

Comments
 (0)