The Japan Rail Pass validity is calculated in days, not in hours. So if you have a 7-day Rail Pass and you start using it on 1st October, whatever the time, this will count as day 1, and you will be able to use until MIDNIGHT on day 7 (7th October, in this example).
If you are travelling on a train at midnight on that day, it’s OK until the end of that journey.