CodeSOD: Historical Pads Note

CodeSOD: Historical Pads

Tim inherited an old Visual Basic application dating from before the year 2000. This application uses custom logic to format years, padding single-digit years with a leading zero. The code converts the year to an integer and then to a string for display. If the year is less than 1000, it prepends a "0". Otherwise, it directly converts the integer year to a string. This formatting was implemented to ensure years were always displayed with four digits. However, the application did not actually need to handle dates prior to 1000 AD. The padding logic for years less than 1000 resulted in a "014" format for 14 AD. This padding was ultimately redundant as later parts of the program reformatted dates using built-in types. Therefore, the padding served no practical purpose for the existing functionality.