The donation occurs when the money leaves your control. If you could have canceled the donation before it was processed in January, then it is a January donation. If you could not have canceled it once submitted on 12/31, then it is 12/31 donation.
The charity may have flexibility in how they report this, depending on how their payment processing system works. If they send you a receipt for 2020, you're fine. If they include this on a 2021 receipt next year and not a 2020 receipt, it still may be a 2020 donation for you, but you will want to keep the documents and make notes as to what happened, in case of audit.