Skip to content

Add ability to specify time range and time increment#14

Open
robertgodfrey wants to merge 7 commits intomarcellosurdi:masterfrom
robertgodfrey:master
Open

Add ability to specify time range and time increment#14
robertgodfrey wants to merge 7 commits intomarcellosurdi:masterfrom
robertgodfrey:master

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.

1 participant