Skip to content

Conversation

@lauft
Copy link
Member

@lauft lauft commented Jan 5, 2026

Using enums instead of strings for month and weekday names should improve type safety and IDE support.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the date handling utilities to use enums (Weekday and Month) instead of string literals for month and weekday names, improving type safety and IDE support across the entire codebase.

Key changes:

  • Introduced Weekday(IntEnum) and Month(IntEnum) to replace string-based weekday/month representations
  • Removed the SmartDayArrow.weekday() method that returned string weekday names (now uses Arrow.weekday() directly which returns integers)
  • Updated all function signatures in utils to accept enum types instead of strings
  • Migrated all holiday definition files across 30+ countries/regions to use the new enum types
  • Added comprehensive test coverage for the enum functionality

Reviewed changes

Copilot reviewed 76 out of 76 changed files in this pull request and generated no comments.

File Description
src/holidata/utils.py Core refactoring: added Weekday/Month enums, removed string constants, updated type signatures, removed custom weekday() method
tests/test_utils.py New comprehensive test file covering enum values and all utility functions with enum usage
src/holidata/holidays/*/*.py Multiple country/region holiday definition files updated to use Month and Weekday enums instead of strings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lauft lauft force-pushed the refactor/use-enums branch 3 times, most recently from 16fd7d8 to 25135e7 Compare January 5, 2026 20:50
Replace strings for weekday and month names with enums

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
@lauft lauft force-pushed the refactor/use-enums branch from 25135e7 to af36311 Compare January 5, 2026 21:06
@lauft lauft merged commit c2a39a3 into main Jan 5, 2026
11 checks passed
@lauft lauft deleted the refactor/use-enums branch January 5, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants