Skip to content
Advertisement

How to define time ranges in React?

this is my code. I’m try to define a range of hours so that it changes color depending on the moment of the day, but I don’t know how to create a range (e.g. from 7 – 12 -> morning). The problem now is that if I put 3am is says morning when I want it to say night, but, of course, I can’t go over 23 hours to set the night. Could you please help me?

JavaScript

Advertisement

Answer

You can just define your ranges more precisely with

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement