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

Add ability to specify time range and time increment #14

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

robertgodfrey
Copy link

@robertgodfrey robertgodfrey commented Apr 1, 2023

Also now displays the time in 12-hr format instead of 24-hr format (just my personal preference).

Examples:

Normal init with default time values:

new DateTimePicker( 'select_datetime', {
  start_date: "2023-04-02T12:30:00",
  last_date: new Date( 2023, 5, 2, 22, 30 ),
  first_day_no: 1,
});

Normal time vals

Specify time window from 12PM to 3PM, 10 minute time interval:

new DateTimePicker( 'select_datetime', {
  start_date: "2023-04-02T12:30:00",
  last_date: new Date( 2023, 5, 2, 22, 30 ),
  first_day_no: 1,
  start_hour: 12,
  end_hour: 15,
  time_increment: 10,
});

Time window 1

Specify time window from 9AM to 5PM, with one hour time interval:

new DateTimePicker( 'select_datetime', {
  start_date: "2023-04-02T12:30:00",
  last_date: new Date( 2023, 5, 2, 22, 30 ),
  first_day_no: 1,
  start_hour: 9,
  end_hour: 18,
  time_increment: 60,
});

Time window 2

The rows adjust dynamically depending on the number of time options specified. If there are 12 time options or less, the number of columns reduces from 6 to 4.

Thank you for creating this and let me know what you think! 😁

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

Successfully merging this pull request may close these issues.

None yet

1 participant