Quick actions

cmd+k|ctrl+k

Navigation

Languages

Days together 

Snippet info

Language

Raku

Visibility

public

Author

fernando-correa

Created

2022-10-21T00:20:27.966391Z

Updated

2022-10-21T00:23:02.884018Z

sub to-date(Str $_) {
    Date.new(:2022year, :month(.[1]), :day(.[0])) given .comb: /\d+/
}

for [
    ('12-01','20-01','15-01','18-01'),
    ('02-03','12-03','13-03','14-03'),
    ('02-03','12-03','11-03','15-03'),
    ('30-03','05-04','28-03','02-04'),
]».&to-date -> ($s1, $e1, $s2, $e2) {
    say +(($s1 .. $e1) ∩ ($s2 .. $e2))
}
INFO