Does the creature know it was charmed if it succeeded the saving throw?

The Charm Person spell description says:

When the spell ends, the creature knows it was charmed by you.

There is an ambiguity here — what happens if the target succeeded the saving throw? On the one hand, the spell ends, so the target should know it was charmed. On the other hand, one might argue the spell wasn’t actually “started”, so literally nothing happens when the saving throw is succeeded.