My old microwave used to do that all the time, it was so annoying lol. I would just unplug it from the wall for a full minute. After plugging it back in, the timer would usually reset and work normally. It's like the little computer inside needed a hard reboot. Saved me from buying a new one for a while.
Yeah, that "hard reboot" thing you mentioned is totally a known fix. I read a forum post once where an appliance repair guy said it clears the memory in the control board. He called it a "capacitor drain," which lets the tiny computer inside forget its error and start fresh.