Course of Raku / Advanced / More about built-in types / Date and time / Exercises / Weeks until Christmas
Solution: Weeks until Christmas
Here is a possible solution to the task.
Code
my $days = Date.new(2026, 12, 25) - Date.new(2026, 6, 27);
say "{$days div 7} weeks and {$days % 7} days";🦋 You can find the source code in the file days-until-christmas.raku.
Output
25 weeks and 6 daysComments
Subtracting one
Datefrom another returns the number of days between them — here181— so no manual counting of the days in each month is needed. The later date is written first, so the result is positive.Integer division
divgives the whole number of weeks (181 div 7is25), and the modulo operator%gives the days left over (181 % 7is6).