Skip to content

Commit

Permalink
Merge pull request #56 from github/file-name-consistency
Browse files Browse the repository at this point in the history
Update year formatting to YYYY-YY format in output
  • Loading branch information
chrisreddington authored Dec 28, 2024
2 parents bdd428f + 226902c commit 2c54ee2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ func formatYearRange(startYear, endYear int) string {
if startYear == endYear {
return fmt.Sprintf("%d", startYear)
}
return fmt.Sprintf("%02d-%02d", startYear%100, endYear%100)
// Use YYYY-YY format for multi-year ranges
return fmt.Sprintf("%04d-%02d", startYear, endYear%100)
}

// generateOutputFilename creates a consistent filename for the STL output
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestFormatYearRange(t *testing.T) {
name: "different years",
startYear: 2020,
endYear: 2024,
want: "20-24",
want: "2020-24",
},
}

Expand Down Expand Up @@ -73,7 +73,7 @@ func TestGenerateOutputFilename(t *testing.T) {
user: "testuser",
startYear: 2020,
endYear: 2024,
want: "testuser-20-24-github-skyline.stl",
want: "testuser-2020-24-github-skyline.stl",
},
}

Expand Down

0 comments on commit 2c54ee2

Please sign in to comment.