Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set specific time slots, e.g(9:00-6:00) #33

Open
SaqibSattar opened this issue Nov 10, 2022 · 4 comments
Open

How to set specific time slots, e.g(9:00-6:00) #33

SaqibSattar opened this issue Nov 10, 2022 · 4 comments

Comments

@SaqibSattar
Copy link

No description provided.

@Thomasevano
Copy link

Thomasevano commented Feb 18, 2023

Hey, have you found something exactly like this one but where we can set a start and end time, or insert an array of timeSlots already given by the API ?

EDIT: I created it by myself with a select

@ZakHargz
Copy link

ZakHargz commented Aug 8, 2023

You could do something like this:

  function timeSlotValidator(slotTime: { getFullYear: () => number; getMonth: () => number; getDate: () => number | undefined; getTime: () => number; }) {
    const eveningTime = new Date(slotTime.getFullYear(), slotTime.getMonth(), slotTime.getDate(),18,0,0);
    const startTime = new Date(slotTime.getFullYear(), slotTime.getMonth(), slotTime.getDate(),8,0,0);

    const isValid = slotTime.getTime() < eveningTime.getTime() && slotTime.getTime() > startTime.getTime()
    return isValid;
  }

@seikosantana
Copy link

@Thomasevano would you mind to share the one you worked on?

@Thomasevano
Copy link

@Thomasevano would you mind to share the one you worked on?

Hey, You can see this, in this project, in this file: https://github.com/Thomasevano/planify-front/blob/main/src/components/Select/Select.jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants