An important part of my spiritual practice is to chant a mantra on a string of beads (similar to a rosary). I chant through the string of beads a certain number of times each day, but when I started I did not have a convenient method of keeping track.
Both the current number and the current day are stored in local storage. This prevents the counter from resetting if the page is refreshed. Each time a user visits the app, the new current day is compared to the day held in storage. If they are different, the counter is reset. This prevents needing to manually reset the counter to 0 each day, though it can be manually reset if necessary.
I used this app extensively for my own purposes, as I found it to be an elegant solution to my problem. However, if I were going to share this solution widely, I would consider making some changes to the user experience. It might not be immediately obvious that the number itself functions as the increment button. Also, some users might need the number to increment beyond 16.
The automatic daily reset will function even if a day is skipped, because the app compares two date strings and resets the counter if they are different. However, there is an edge case in which a user could use the app on one date and not again until a month later. If the two dates were the same number (for example, April 1st and May 1st), the counter would not reset itself. I did not address this because it did not seem like a very likely scenario, and the counter can always be manually reset.
Finally, I found that when using this app on my phone, the page would sometimes automatically refresh. If I was without data signal at the time, I would not be able to reload the page until I regained a signal. Therefore, this project would benefit from becoming a stand-alone app that could be used without connectivity.