Conditional Rendering of Component based on Time Range

I have this form and I want my form responder to respond to it only if the time is between 2 pm to 7 am. So I put the fields in a panel and used this JavaScript to conditionally show the panel.

TypeScript

Copy

const currentTime = moment();
const startTime = moment().set({hour: 13, minute: 0}); 
const endTime = moment().set({hour: 6, minute: 0}); 

show = currentTime.isBetween(startTime, endTime);


It's currently 2:31 PM here but the panel is still not showing.

1 reply