Ask your DM
This is something that I would say is 100% DM's discretion but be consistent in the campaign.
On one hand it's promoting being efficient and utilizing all of the caster's resources. On the other hand if you are in a persistent campaign and you have a day that you are not doing any combat before you have a day that you expect to have combat you can buff your caster or the party immensely for the entire day after.
For example, in a campaign where you are taking a long rest in an inn during a day of down time in a town the odds of you using even half your spell slots that day are minuscule, leaving you a large list of spells you can cast: mage armor, darkvision, and any other non concentration based buff spells before you regain all your spell slots at the end of the long rest and the next day when you go into combat be OP against any encounters for the day.
A wizard with a 20 DEX could cast mage armor to boost their AC to 18 for the day and combining that with shield brings their AC over 20. Not to mention the other items they could have that boost AC making the caster as long as they have 1 good DPS Spell and the rest buffs, they'd be close to untouchable in combat while being able to deal a bunch of damage.
This effectively removes one of the wizard's biggest weak points is that their AC, unless they use shield, rarely goes up to 20. There are always ways to abuse this ruling if you allow it in your game. I personally started allowing it and almost instantly regretted it due to one of my players abusing it to become a god whenever they could using this rule.