Skip to content

Calendar versioning reference ​

Calendar versioning codes ​

The following table lists the available format codes for calendar versioning (CalVer) schemes. The codes can be used to define the version format in the calver_format configuration options. Formatting codes, surrounded by { } can be combined to create a custom version format. For example, the format YYYY.MM.DD can be defined as "{YYYY}.{MM}.{DD}".

CodeExample(s)Comment
YYYY2000, 2001, …, 2099Full year
YY0, 1, 2, …, 99, 100Short year as integer (year − 2000)
0Y00, 01, 02, …, 100Short year (year − 2000), zero-padded to two digits
MMMJan, Feb, jan, févMonth abbreviation, locale-based
MM1, 2, …, 12Month as integer
0M01, 02, …, 12Month, zero-padded
DD1, 2, …, 31Day of month as integer
0D01, 02, …, 31Day of month, zero-padded
JJJ1, 2, 3, …, 366Day of year as integer
00J001, 002, …, 366Day of year, zero-padded
Q1, 2, 3, 4Quarter
WW0, 1, 2, …, 53Week number, Monday is first day
0W00, 01, 02, …, 53Week number, Monday is first day, zero-padded
UU0, 1, 2, …, 53Week number, Sunday is first day
0U00, 01, 02, …, 53Week number, Sunday is first day, zero-padded
VV1, 2, …, 53ISO 8601 week number as integer
0V01, 02, …, 53ISO 8601 week number, zero-padded
GGGG2000, 2001, …, 2099ISO 8601 week-based year
GG0, 1, 2, …, 99ISO 8601 short week-based year as integer
0G01, 02, …, 99ISO 8601 short week-based year, zero-padded
toml
[tool.bumpversion.parts.release]
calver_format = "{YYYY}.{MM}.{DD}"

Parsing CalVer versions ​

Using the following chart, we can set up the version parsing:

CodeRegex
YYYY(?:[1-9][0-9]{3})
YY(?:[1-9][0-9]?|0|[1-9][0-9]{2})
0Y(?:[0-9]{2}|[0-9]{3})
MMMSee below
MM(?:1[0-2]|[1-9])
0M(?:1[0-2]|0[1-9])
DD(?:3[0-1]|[1-2][0-9]|[1-9])
0D(?:3[0-1]|[1-2][0-9]|0[1-9])
JJJ(?:36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|[1-9][0-9]|[1-9])
00J(?:36[0-6]|3[0-5][0-9]|[1-2][0-9][0-9]|0[1-9][0-9]|00[1-9])
Q(?:[1-4])
WW(?:5[0-3]|[1-4][0-9]|[0-9])
0W(?:5[0-3]|[0-4][0-9])
UU(?:5[0-3]|[1-4][0-9]|[0-9])
0U(?:5[0-3]|[0-4][0-9])
VV(?:5[0-3]|[1-4][0-9]|[1-9])
0V(?:5[0-3]|[1-4][0-9]|0[1-9])
GGGG(?:[1-9][0-9]{3})
GG(?:[0-9][0-9]?)
0G(?:[0-9]{2})

Month abbreviations

The month abbreviation is locale-based. Here are some examples:

(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) for English

(?:jan|fév|mar|avr|mai|jui|jui|aoû|sep|oct|nov|déc) for French

You can use these regular expressions to parse CalVer versions in your project. For example, the following parse configuration can be used to parse a version string in the format YYYY.MM.DD as the release part of the version string:

toml
[tool.bumpversion]
parse = """(?x)                      # Verbose mode
    (?P<release>
        (?:[1-9][0-9]{3})\\.         # YYYY.
        (?:1[0-2]|[1-9])\\.          # MM.
        (?:3[0-1]|[1-2][0-9]|[1-9])  # DD
    )
"""