I can’t remember the specific use case I had or if I had one. It’s just a convenience thing more than anything which I default to whenever using calendar versioning.
For example, if someone has downloaded the latest release in October, it will appear after the September release in their downloads folder (if sorting alphabetically). Any files someone has in github prefixed with the version number will display in chronological order rather than jumping up every October, etc.
The biggest advantage comes in programatically working with the version numbers though. Here’s a python example of grabbing the latest version number in the two formats:
versions = ['2022.1','2022.2','2022.3','2022.4','2022.5','2022.6','2022.7','2022.8','2022.9','2022.10','2022.11','2022.12']
versionsPadded = ['2022.01','2022.02','2022.03','2022.04','2022.05','2022.06','2022.07','2022.08','2022.09','2022.10','2022.11','2022.12']
# Attempting to sort the list and grab the last element results in the wrong value
latestVersion = sorted(versions)[-1]
print(latestVersion) # 2022.9 Wrong!
# Instead you have to split it into parts, sort numerically and recombine
# This only covers year.month and not patch.
# There may be more efficient ways to do this which allows for more parts.
latestVersionYear = sorted(versions)[-1].split('.')[0]
monthReleasesForLatestYear = [int(v.split('.')[1]) for v in versions if v.startswith(f'{latestVersionYear}.')]
latestMonthReleaseForYear = sorted(monthReleasesForLatestYear)[-1]
latestRelease = f'{latestVersionYear}.{latestMonthReleaseForYear}'
print(latestRelease) # 2022.12 Correct!
# With padded version numbers, sorting alphabetically is sufficient
latestVersion = sorted(versionsPadded)[-1]
print(latestVersion) # 2022.12 Correct!
From the other side of building up the version number, it only requires one extra line:
buildYear = 2022
buildMonth = 5
# Current format
print(f'{buildYear}.{buildMonth}') # 2022.5
# Padded format
paddedBuildMonth = f'0{buildMonth}'[-2:]
print(f'{buildYear}.{paddedBuildMonth}') # 2022.05
Not tried this but I expect a comparison would also work with zero-padded:
if myVersion < currentVersion:
# Do something...
To be clear, I only see this as a nice to have but that’s just my opinion and not necessarily those of the people voting. I’m not sure how many places sorting like this would happen so it may be more effort to use zero-padded numbers than I realise (although the parsing as above should work both with and without zero-padding). If it’s going to take much effort, I would much rather the focus stay on some of those great features you bring us each month!