Hey man, you're absolutely right, when you tried to rewind time right after a battle, it couldn't go back from a certain point (the exact moment the battle ended) and generated the error you were experiencing.
I updated the JS file with two fixes: a safety check that prevents crashes if you're going back to point 0 after the battle, and a cleanup function at the battle exit so that the battle time doesn't overwrite the map time. I did some tests and everything seems to be in order.
Please download Kadajah_TimeRewind.js again and try to reproduce the behavior that caused the error.
Thank you for your time and for the accurate log. I apologize for the inconvenience, and feel free to ask if you need anything else!