Dynamically Update Text Based On Date

I have read a lot about how to get the current date and use DateTime, but I cannot figure something out.

I am trying to update a variable in a typescript file based on the day. Right when the next day hits, I want this variable to be updated.

How do I do this? I figured out a way to update it whenever I navigate to another page, but this requires if statements in every page’s typescript file’s ngInit() checking if the current date is equal to the date the last time I loaded a page.

I would appreciate any ideas.

You can use an rxjs Observable that triggers every x seconds/milliseconds.
–> https://stackoverflow.com/questions/35813310/how-to-create-timer-in-angular2