I got tired of entering in screen time manually and calculating what time was with work apps and necessary apps. I have screenshots of the two shortcuts I created.
Note the appopen variable is there to prevent double app opens causing time issues. This would occur if you got a phone call or if a password manager was used while you had an app opened. As it would not count the current app as closed. It would then count the app as opened again after the phone mcall or password manager part was over making the lastdate variable incorrect (note could of named this variable better was actually used for something else originally) causing a time discrepancy. Note only have been testing it for a day will update if I run into any issues.
The pause is for background audio reminds me not to exit an app with audio so it counts against my screen time. To be clear YouTube can be played in the background but it will be logged once I leave the app.
Also note the Data Jar app is required for it to work however it is a free app.
Also also I am really tired so my less than stellar writing is even worse for this post. Let me know if you have any questions.