Expression returns false even though it should return true

MMacke11/21/2022
Hi, I'm trying to check if a date is before now or after NOW. While debugging i can see that the expression doesn't return true even though it should.
ImageImage
PPobiega11/21/2022
can you show the value of .Planned here?
MMacke11/21/2022
it's above the bigger screenshot
MMacke11/21/2022
@Pobiega
PPobiega11/21/2022
right, really hard to see 😄
PPobiega11/21/2022
well, thats... very weird.
PPobiega11/21/2022
I've never in my 20 years of programming encountered an actual "true is false" bug so I doubt we are seeing one here either
MMacke11/21/2022
hahah sorry, yea i'm kind of scratching my head.
MMacke11/21/2022
yea there must be something i'm doing wrong
TTheBoxyBear11/21/2022
There was another post yesterdya where the debugger showed "" != "" so could be a similar thing here?
TTheBoxyBear11/21/2022
Assuming it's 10:52 or earlier where op lives then it doesn't make sense
MMacke11/21/2022
it's 12.52 pm here
TTheBoxyBear11/21/2022
Planned is for 11:40
MMacke11/21/2022
yea
MMacke11/21/2022
I guess i'll explain
MMacke11/21/2022
i have a list with objects and if time has passed past the .Planned property i want to remove it from the list
TTheBoxyBear11/21/2022
So even if DateTime.Now advances, it wouldn't change the outcome
MMacke11/21/2022
So i have objects i need to remove that are tomorrow and before the time that is now
MMacke11/21/2022
List<int> indexestoremove = new List<int>();
        List<FlightData> data = GetData();
        if(data == null)
        {
            return null;
        }
        for (int y = 0; y < data.Count; y++)
        {
            if (data[y].Planned < DateTime.Now)
            {
                if (data[y].Estimated == null || data[y].Estimated < DateTime.Now || data[y].Planned.Date > DateTime.Now)
                {
                    indexestoremove.Add(y);
                }
                
            }
        }

        foreach (var item in indexestoremove)
        {
            data.RemoveAt(item);
        }
TTheBoxyBear11/21/2022
Does it run the if anyway with a breakpoint?
TTheBoxyBear11/21/2022
If so, then the debugger is messed up :dviperShrug:
MMacke11/21/2022
there's no exception
MMacke11/21/2022
and i'm not expecting there to be one
TTheBoxyBear11/21/2022
No exception, just if it enters the if block
MMacke11/21/2022
i'll check one sec
MMacke11/21/2022
oh my god
MMacke11/21/2022
i just saw it
MMacke11/21/2022
i'm so stupid
MMacke11/21/2022
It removes the objects that are before now
MMacke11/21/2022
but not after today
MMacke11/21/2022
But it's because I'm first checking if it's less than now and then checking if it's more than today
MMacke11/21/2022
so since it's not less than now it's never gonna reach the second if block
MMacke11/21/2022
it's at moments like this i'm wondering if i really should be doing this lol
TTheBoxyBear11/21/2022
We all make dumb mistakes
MMacke11/21/2022
quick question, do list indexes start at 0 or 1?