5 presumably -D days earlier does not mean D days later (double negative)
source | link

In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for Dungeons & Dragons. Of course, theyeach have their own calendar.

Given a valid date of the Calendar of Harptos, as well as an integer D, output the date D days later. Note that D may be negative, in which case you should return the date -D days earlier.

In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for Dungeons & Dragons. Of course, they have their own calendar.

Given a valid date of the Calendar of Harptos, as well as an integer D, output the date D days later. Note that D may be negative, in which case you should return the date -D days earlier.

In an effort to level the playing field between languages with built-in date libraries and those without, let's work with a fictional calendar. The Forgotten Realms are a (the?) campaign setting for Dungeons & Dragons. Of course, each have their own calendar.

Given a valid date of the Calendar of Harptos, as well as an integer D, output the date D days later. Note that D may be negative, in which case you should return the date D days earlier.

4 added 1860 characters in body
source | link

Test cases with negative D omitted. Any test case can be inverted. The first dozen or so test cases should test all the edge cases surrounding holidays and leap years. The othersnext set are to test that ranges across multiple years work and all months and holidays have been implemented. The second half is all the same test cases again but with negative offsets.

"30, Summertide, 1491 DR" 1                 => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2                 => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                      => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1                 => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2                 => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3                 => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                      => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                      => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                     => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365                   => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365                   => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365                   => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                    => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365                   => "Midsummer, 1501 DR"

"14, Deepwinter, 654 DR" 5069               => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                     => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813        => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                    => "9, The Claw of the Sunsets, 77 DR"
"30, The Melting, 321 DR" 394               => "29, The Time of Flowers, 322 DR"
"17, The Time of Flowers, 867 DR" 13579     => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456               => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616             => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499                => "30, The Drawing Down, 2000 DR"

"Midsummer, 1491 DR" -1                     => "30, Summertide, 1491 DR"
"1, Highsun, 1491 DR" -2                    => "30, Summertide, 1491 DR"
"1, Highsun, 1491 DR" -1                    => "Midsummer, 1491 DR"
"Midsummer, 1492 DR" -1                     => "30, Summertide, 1492 DR"
"Shieldmeet, 1492 DR" -2                    => "30, Summertide, 1492 DR"
"1, Highsun, 1492 DR" -3                    => "30, Summertide, 1492 DR"
"Shieldmeet, 1492 DR" -1                    => "Midsummer, 1492 DR"
"1, Highsun, 1492 DR" -2                    => "Midsummer, 1492 DR"
"1, Highsun, 1492 DR" -1                    => "Shieldmeet, 1492 DR"
"1, Highsun, 1491 DR" -365                  => "1, Highsun, 1490 DR"
"Shieldmeet, 1492 DR" -365                  => "1, Highsun, 1491 DR"
"Midsummer, 1493 DR" -365                   => "Shieldmeet, 1492 DR"
"Midsummer, 1494 DR" -365                   => "Midsummer, 1493 DR"
"Midsummer, 1501 DR" -365                   => "Shieldmeet, 1500 DR"

"The Feast of the Moon, 667 DR" -5069       => "14, Deepwinter, 654 DR"
"15, The Fading, 38 DR" -7897               => "Midwinter, 17 DR"
"25, The Claw of the Storms, 1002 DR" -813  => "3, The Claw of Winter, 1000 DR"
"9, The Claw of the Sunsets, 77 DR" -26246  => "Greengrass, 5 DR"
"29, The Time of Flowers, 322 DR" -394      => "30, The Melting, 321 DR"
"20, Highsun, 904 DR" -13579                => "17, The Time of Flowers, 867 DR"
"30, The Drawing Down, 1815 DR" -456        => "Highharvestide, 1814 DR"
"16, Leaffall, 1824 DR" -3616               => "23, The Rotting, 1814 DR"
"30, The Drawing Down, 2000 DR" -730499     => "1, Deepwinter, 1 DR"

Test cases with negative D omitted. Any test case can be inverted. The first dozen or so test cases should test all the edge cases surrounding holidays and leap years. The others are to test that ranges across multiple years work and all months and holidays have been implemented.

"30, Summertide, 1491 DR" 1             => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2             => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                  => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1             => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2             => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3             => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                  => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                  => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                 => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365               => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365               => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365               => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365               => "Midsummer, 1501 DR"

"14, Deepwinter, 654 DR" 5069           => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                 => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813    => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                => "9, The Claw of the Sunsets, 77 DR"
"30, The Melting, 321 DR" 394           => "29, The Time of Flowers, 322 DR"
"17, The Time of Flowers, 867 DR" 13579 => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456           => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616         => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499            => "30, The Drawing Down, 2000 DR"

The first dozen or so test cases should test all the edge cases surrounding holidays and leap years. The next set are to test that ranges across multiple years work and all months and holidays have been implemented. The second half is all the same test cases again but with negative offsets.

"30, Summertide, 1491 DR" 1                 => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2                 => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                      => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1                 => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2                 => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3                 => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                      => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                      => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                     => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365                   => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365                   => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365                   => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                    => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365                   => "Midsummer, 1501 DR"

"14, Deepwinter, 654 DR" 5069               => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                     => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813        => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                    => "9, The Claw of the Sunsets, 77 DR"
"30, The Melting, 321 DR" 394               => "29, The Time of Flowers, 322 DR"
"17, The Time of Flowers, 867 DR" 13579     => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456               => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616             => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499                => "30, The Drawing Down, 2000 DR"

"Midsummer, 1491 DR" -1                     => "30, Summertide, 1491 DR"
"1, Highsun, 1491 DR" -2                    => "30, Summertide, 1491 DR"
"1, Highsun, 1491 DR" -1                    => "Midsummer, 1491 DR"
"Midsummer, 1492 DR" -1                     => "30, Summertide, 1492 DR"
"Shieldmeet, 1492 DR" -2                    => "30, Summertide, 1492 DR"
"1, Highsun, 1492 DR" -3                    => "30, Summertide, 1492 DR"
"Shieldmeet, 1492 DR" -1                    => "Midsummer, 1492 DR"
"1, Highsun, 1492 DR" -2                    => "Midsummer, 1492 DR"
"1, Highsun, 1492 DR" -1                    => "Shieldmeet, 1492 DR"
"1, Highsun, 1491 DR" -365                  => "1, Highsun, 1490 DR"
"Shieldmeet, 1492 DR" -365                  => "1, Highsun, 1491 DR"
"Midsummer, 1493 DR" -365                   => "Shieldmeet, 1492 DR"
"Midsummer, 1494 DR" -365                   => "Midsummer, 1493 DR"
"Midsummer, 1501 DR" -365                   => "Shieldmeet, 1500 DR"

"The Feast of the Moon, 667 DR" -5069       => "14, Deepwinter, 654 DR"
"15, The Fading, 38 DR" -7897               => "Midwinter, 17 DR"
"25, The Claw of the Storms, 1002 DR" -813  => "3, The Claw of Winter, 1000 DR"
"9, The Claw of the Sunsets, 77 DR" -26246  => "Greengrass, 5 DR"
"29, The Time of Flowers, 322 DR" -394      => "30, The Melting, 321 DR"
"20, Highsun, 904 DR" -13579                => "17, The Time of Flowers, 867 DR"
"30, The Drawing Down, 1815 DR" -456        => "Highharvestide, 1814 DR"
"16, Leaffall, 1824 DR" -3616               => "23, The Rotting, 1814 DR"
"30, The Drawing Down, 2000 DR" -730499     => "1, Deepwinter, 1 DR"
3 added 3 characters in body
source | link
"30, Summertide, 1491 DR" 1             => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2             => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                  => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1             => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2             => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3             => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                  => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                  => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                 => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365               => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365               => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365               => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365               => "Midsummer, 1501 DR"

"14, Deepwinter, 654 DR" 5069            => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                 => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813    => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                => "9, The Claw of the Sunsets, 77 DR"
"30, The Melting, 321 DR" 394            => "30"29, The DrawingTime Downof Flowers, 322 DR"
"17, The Time of Flowers, 867 DR" 13579 => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456           => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616         => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499            => "30, The Drawing Down, 2000 DR"
"30, Summertide, 1491 DR" 1             => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2             => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                  => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1             => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2             => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3             => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                  => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                  => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                 => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365               => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365               => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365               => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365               => "Midsummer, 1501 DR"

"14 Deepwinter, 654 DR" 5069            => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                 => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813    => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                => "9, The Claw of the Sunsets, 77 DR"
"30 The Melting, 321 DR" 394            => "30, The Drawing Down, 322 DR"
"17, The Time of Flowers, 867 DR" 13579 => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456           => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616         => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499            => "30, The Drawing Down, 2000 DR"
"30, Summertide, 1491 DR" 1             => "Midsummer, 1491 DR"
"30, Summertide, 1491 DR" 2             => "1, Highsun, 1491 DR"
"Midsummer, 1491 DR" 1                  => "1, Highsun, 1491 DR"
"30, Summertide, 1492 DR" 1             => "Midsummer, 1492 DR"
"30, Summertide, 1492 DR" 2             => "Shieldmeet, 1492 DR"
"30, Summertide, 1492 DR" 3             => "1, Highsun, 1492 DR"
"Midsummer, 1492 DR" 1                  => "Shieldmeet, 1492 DR"
"Midsummer, 1492 DR" 2                  => "1, Highsun, 1492 DR"
"Shieldmeet, 1492 DR" 1                 => "1, Highsun, 1492 DR"
"1, Highsun, 1490 DR" 365               => "1, Highsun, 1491 DR"
"1, Highsun, 1491 DR" 365               => "Shieldmeet, 1492 DR"
"Shieldmeet, 1492 DR" 365               => "Midsummer, 1493 DR"
"Midsummer, 1493 DR" 365                => "Midsummer, 1494 DR"
"Shieldmeet, 1500 DR" 365               => "Midsummer, 1501 DR"

"14, Deepwinter, 654 DR" 5069           => "The Feast of the Moon, 667 DR"
"Midwinter, 17 DR" 7897                 => "15, The Fading, 38 DR"
"3, The Claw of Winter, 1000 DR" 813    => "25, The Claw of the Storms, 1002 DR"
"Greengrass, 5 DR" 26246                => "9, The Claw of the Sunsets, 77 DR"
"30, The Melting, 321 DR" 394           => "29, The Time of Flowers, 322 DR"
"17, The Time of Flowers, 867 DR" 13579 => "20, Highsun, 904 DR"
"Highharvestide, 1814 DR" 456           => "30, The Drawing Down, 1815 DR"
"23, The Rotting, 1814 DR" 3616         => "16, Leaffall, 1824 DR"
"1, Deepwinter, 1 DR" 730499            => "30, The Drawing Down, 2000 DR"
    Tweeted twitter.com/StackCodeGolf/status/679375538381824000
2 deleted 36 characters in body
source | link
1
source | link