There is a booking sytem in the website by scheduling an appointment selecting date and time
There will be a button in the client dashboard and the vendor dashboard. That button should be disabled all the time. It will be enabled if the date and time are met.
I am thinking of something like
If date and time are bigger than or equals to appointment data, then enable button to join a call, Else keep it disabled.
but I think the bigger than won’t work. Let’s say the appointmnet is from 10 - 11
If I choose bigger than then the button will remain enabled even if the time is 11:01 or passed 11 way forward.
What is the best practice /code to implement such statement?
Why don’t you just not display a button if the time isn’t right? It makes no sense to have a button sitting there and people clicking it “thinking” that the button will do its job. And then people complaining that the button isn’t working and saying that it’s “broken” when it really isn’t.
You first have to define the logic with a few true/false samples. I don’t really get in which situations the button would be enabled, depending on the date.
I would suggest playing with DateTime before you take any steps. This makes sense since you want to display the button at a certain time so it is appropriate to get familiarized with the function.