Hello MelodyJulia
A Swiss Travel Pass is, as any other national ticket, valid on the mentioned date(s) from 00:00 to 05:00 AM the next morning.
There are no 24 hours national tickets, they are always valid for a calendar day, plus 5 hours of the next day.
A 3-day Swiss Travel Pass that is bought on 1st July 18:00, and you do not change its validity manually, is valid on 1, 2, 3 till 4th July 05:00 AM. Thus, you miss 18 hours of its validity. In such a case, purchase a ticket for 1st July and make the STP starting from 2nd July, by selecting the validity start date for 2 July.
Kind regards,
Roland