An import can turn a modest piece of information into a claim nobody made. A customer supplied a day and month. The software returns a complete date. Somewhere between those two events, a year appeared.
For an independent business using AI to write a small Python script, that can look like successful automation. The field is populated, the spreadsheet is tidy and the next step can run. But an anniversary, a dated transaction and a future appointment are different kinds of information. Filling the same date column does not make them interchangeable.
The useful question is therefore bigger than whether the parser accepts the text: what is the year supposed to mean, and where does that meaning come from?
The default you did not ask for
Python’s version 3.13 datetime documentation explains that strptime supplies unspecified components from a default date beginning in 1900. Parsing a day and month can therefore produce a year that was absent from the input. The documentation also explains why 29 February causes trouble: that default year is not a leap year.
In a local Python 3.12.14 check for this article, datetime.strptime('28/02', '%d/%m').date() returned 1900-02-28. Substituting '29/02' raised ValueError. These are version-specific demonstrations, not a promise that every installation behaves identically.
Version matters here. The Python 3.15 documentation says a format specifying a day of the month with %d but no year raises ValueError. Ask an AI assistant to identify the runtime it is targeting and check the documentation for that version.
Decide which fact the record contains
Consider a hypothetical ceramics studio with three files. One lists the day and month of an annual open-studio celebration. Another records delivery dates for completed orders. The third contains bookings for next season’s workshops.
For the annual celebration, a month-and-day pair may be all the studio intends to store. For a completed delivery, an unknown year is missing historical evidence. For a workshop booking, the year is part of the commitment. A single rule that adds the current year to every row would answer three different questions with the same assumption.
Write the rule in ordinary language before requesting code. For example: ‘This field describes a recurring calendar occasion. Preserve month and day, and do not treat the validation year as the year the occasion began.’ Or: ‘This field describes an actual delivery. Reject incomplete dates for review rather than inventing a year.’
That sentence gives the assistant a requirement you can inspect. ‘Fix the date error’ leaves the business meaning unresolved.
A leap year can validate a pattern
For a month-and-day value, an explicit leap year can be useful as a temporary validation aid. The Python documentation demonstrates that approach. In the local check, datetime.strptime('29/02;2000', '%d/%m;%Y') accepted the value.
The important design choice comes afterwards. If the product needs only a recurring occasion, retain the validated month and day as such. Label the field accordingly. Do not export the temporary year in a column called ‘date of event’, where a colleague could reasonably interpret it as history.
Imagine a future assistant summarising that export. A full-looking date could encourage it to describe a celebration as having happened in 2000. That is a hypothetical downstream mistake, but it shows why a technical convenience should carry an explicit boundary. A validation scaffold should not become evidence about the world.
Choosing this year is another decision
Adding a real target year changes the task. In the same local test, '29/02;2026' with the explicit year format raised ValueError. A month-and-day pattern that works in a leap year does not automatically provide an occurrence in every target year.
Suppose the studio wants an annual reminder for an occasion recorded as 29 February. Its owner must decide what the reminder should do in other years: use a chosen neighbouring date, skip that year or request review. Those are proposed product policies. The parser cannot establish which one the owner intended.
Keep the original occasion separate from any calculated reminder date. Then changing the reminder policy need not rewrite the information originally collected. Show the calculated result to the person responsible before allowing it to send messages or create bookings.
Test the meaning through the whole workflow
Use a small fictional file that includes an ordinary month-and-day value, 29 February, an impossible date such as 31 April, an empty field and a complete date where one is required. Decide the expected outcome for each before running the import.
Inspect both the accepted records and the review output. An error message should help someone repair the source: identify the row, preserve the submitted text and explain which part is missing or invalid. A blanket ‘bad date’ message creates work without clarifying the decision.
Then export the accepted data and reopen it in the next tool. Check whether the field still expresses a recurring occasion or whether the handover has turned it into an apparent historical date. If the workflow proceeds to appointments, the separate issue of keeping the time zone with the appointment also needs attention.
Ask the assistant to explain every supplied component in one example output. Which values came from the file? Which came from a documented business rule? Which exist only to help validation? A complete-looking date is useful only when those answers remain clear.
Sources
Python 3.13: datetime parsing behaviour and partial dates; Python 3.15: datetime.strptime and year requirements. Versioned reference documentation checked on 7 November 2026. Studio examples and workflow recommendations are illustrative editorial analysis.
Discover more from Marychuks.com AI, Psychology, Business & CreativeVerse
Subscribe to get the latest posts sent to your email.