I would actually subscribe to what some others said:
It's really mainly how much you eat, not when. The fuel you put in has to be below what you burn off to lose weight, as simple as that. If you put in more than you burn, you put on weight, and for that, it ultimately doesn't matter when you eat.
Of course it's not nutritionally sane and unhealthy to just get your fuel from sweets and refined sugars, but if you wanted to, you could even eat biscuits and chocolates galore at night and still lose weight.
When I still worked at the theatre, I would very often eat a massive Pizza at one in the morning, and I was VERY slim back then. I eat far less now, but I'm also less active, so we really need to adjust how much we actually eat. We discussed this in another thread: A lot of people simply have no concept of how many calories the stuff they eat contains. They think they eat healthily because they eat hummus and nuts and fail to see that these things have so many calories that a pot/bag contains half your daily calorie allowance
Or they drink tons of fizzy pop or alcohol and don't include these in their daily calorie allowance. That's why I suggested back then to use something like My Fitness Pal to actually get a feeling for how much you are allowed, and what you actually eat/burn. It really helps some people to be more aware.
What is undoubtedly true though is that some foods are more "nutritionally dense" than others, or that they make your blood sugar crash, and also that starving all day sets you up for a massive binge at night: It's not so much that you eat late, it's more the fact that you probably overeat at night because you're starving. Some people also get acid reflux or disturbed sleep if they eat too late - all valid reasons not to eat late.
I usually eat dinner well after 8 every day and try to go for chicken or fish and veg/salad these days, but it doesn't always work out (and the ODD late night binge doesn't really present a problem). I really found though that it's not so much WHEN I eat at night, but more that I don't allow myself to get hungry during the day. Which means: Decent breakfast/lunch with lots of protein and wholemeal or pulses so my bloodsugar doesn't crash, and then a few light snacks when I teach - that's why it's imho so important to schedule small breaks here and there.
And above all: Staying active! I actually feel less hungry when I do regular exercise...