Skip to content

Fix NT Picnic Day: first Monday of August (DEV-30999) - #14

Merged
mikkotansc merged 1 commit into
holidays-april-16-2025from
feature/fix-nt-picnic-day-first-monday
Jul 24, 2026
Merged

Fix NT Picnic Day: first Monday of August (DEV-30999)#14
mikkotansc merged 1 commit into
holidays-april-16-2025from
feature/fix-nt-picnic-day-first-monday

Conversation

@mikkotansc

Copy link
Copy Markdown

Problem

NT Picnic Day (au_nt) is defined with a hardcoded date:

picnic_day_from_2025 => Date.civil(year, 8, 4)

Picnic Day is legislated as the first Monday of August. The hardcoded 4th only coincidentally matched reality in 2025 (4 Aug 2025 was the first Monday). It resolves incorrectly for:

Year Was (hardcoded) Correct (1st Mon Aug)
2025 Mon 4 Aug ✅ Mon 4 Aug
2026 Tue 4 Aug ❌ Mon 3 Aug
2027 Wed 4 Aug ❌ Mon 2 Aug

This feeds ShiftCare's auto-populated public holidays → payroll/timesheets for all NT accounts. Reported via escalation DEV-30999 (account Being Mentors NT).

Fix

Compute the first Monday of August using DateCalculatorFactory.day_of_month_calculator, mirroring the existing qld_queens_bday_october definition in the same file. The year >= 2025 gate is preserved, so pre-2025 historical data is unchanged.

DateCalculatorFactory.day_of_month_calculator.call(year, 8, :first, :monday)

Tests

Added regression assertions to au.yaml (tests: block) and regenerated test/defs/test_defs_au.rb:

assert_equal "Picnic Day", Date.civil(2025, 8, 4).holidays(:au_nt)[0][:name]
assert_equal "Picnic Day", Date.civil(2026, 8, 3).holidays(:au_nt)[0][:name]
assert_equal "Picnic Day", Date.civil(2027, 8, 2).holidays(:au_nt)[0][:name]
assert_equal [], Date.civil(2026, 8, 4).holidays(:au_nt)   # the old hardcoded-4th bug

The AU defs test passes (109 assertions, 0 failures). The 8 pre-existing suite failures are unrelated US/CA definition drift (identical count on the base branch).

Notes

  • Base branch is holidays-april-16-2025 (the branch the app's Gemfile pins), following PR Add ANZAC Day 2026 observed holiday for NSW (April 27) #13.
  • Diff is scoped to au.yaml, au.rb, test/defs/test_defs_au.rb. Unrelated rake generate churn in REGIONS.rb/nz.rb was excluded.
  • Follow-up (separate): Melbourne Cup missing for VIC-Melbourne accounts — likely an app-side region-mapping issue, not this gem.

Picnic Day (au_nt) was defined as a hardcoded Date.civil(year, 8, 4),
which only coincidentally matched the real holiday in 2025. NT Picnic
Day is legislated as the first Monday of August, so 2026 (Mon 3 Aug)
and 2027 (Mon 2 Aug) resolved incorrectly to the 4th.

Compute the first Monday of August via day_of_month_calculator,
mirroring the existing qld_queens_bday_october definition. Keeps the
`year >= 2025` gate so pre-2025 historical data is unchanged.

Generated: Australia. Regenerated au.rb + test/defs/test_defs_au.rb via
`rake generate` (unrelated REGIONS.rb/nz.rb generator drift excluded).
Copilot AI review requested due to automatic review settings July 24, 2026 03:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the Northern Territory (AU-NT) “Picnic Day” holiday definition so it correctly follows legislation (first Monday of August) instead of a hardcoded August 4th date, preventing incorrect holiday population in downstream payroll/timesheet flows.

Changes:

  • Replaced the fixed Date.civil(year, 8, 4) computation with a “first Monday of August” calculation for year >= 2025.
  • Added regression test cases for 2025–2027 and a negative assertion for the previously-buggy 2026-08-04 case in both the YAML tests block and the generated AU defs test file.
  • Regenerated the AU generated definitions to reflect the updated custom method.

Reviewed changes

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

File Description
definitions/au.yaml Updates picnic_day_from_2025 to compute the first Monday of August and adds regression assertions in the YAML tests: block.
lib/generated_definitions/au.rb Regenerates the AU custom method implementation to use DateCalculatorFactory.day_of_month_calculator for Picnic Day.
test/defs/test_defs_au.rb Adds explicit regression assertions for Picnic Day dates (2025–2027) and verifies the old hardcoded date no longer returns a holiday.

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

@mikkotansc
mikkotansc requested review from a team, djstozza and shailyJain12 July 24, 2026 03:26
@mikkotansc
mikkotansc merged commit db5cffa into holidays-april-16-2025 Jul 24, 2026
1 check passed
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.

5 participants