This is my today's attempt, but the web says my an...
# advent-of-code
l
This is my today's attempt, but the web says my answer is wrong. I am pretty confident I should have it right, but I have no idea what is wrong though :-)), so it seems I am stuck for now ...
j
What exactly is that DateTime class? That's not in the standard lib is it?
t
It’s in the java standard lib
j
Is it? Can't for the life of me find it... Reason I ask is because maybe the
to
infix function includes the end datetime, when it shouldn't
s
while(sleeptime.isBefore...
. It must be inclusive. Your code checks exclusively, right?
Nvm, I'm stupid. It must be exclusive.
l
It's good old Jodatime java library😊. I will try to check/change end time exclusivity and see if that was the issue.
Guys, you won't believe me, what was the actual error ... when I did
DateTime(javaDate)
it parsed original 1518-11-01 as a 1518-11-10 for whatever reason. So I had to parse the string manually right into DayTime and that fixed the issue. Probably it is some bug in the Jodatime library ... pretty nasty one 🙂, but I am happy I've moved on 😁
j
Huh! That's quite the issue! Good find 🙂
l
Btw I found out it is a good practice to try your code on those small examples first. There it is usually more apparent when there is something wrong 🙂
👍 2
g
I always write the unit test first for these, which is just a function that takes a String array as input, the function to use, and the expected outcome