{"size": 1194, "ext": "js", "max_stars_repo_path": "client/src/components/HomeComponents/UserCalendar/index.js", "max_stars_repo_name": "seanbelverstone/Bird-Bird-Ordering", "max_stars_repo_stars_event_min_datetime": "2020-07-02T13:26:44.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-02T13:26:44.000Z", "max_issues_repo_path": "client/src/components/HomeComponents/UserCalendar/index.js", "max_issues_repo_name": "seanbelverstone/Bird-Bird-Ordering", "max_issues_repo_issues_event_min_datetime": "2020-05-20T20:45:33.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-20T20:45:33.000Z", "max_forks_repo_path": "client/src/components/HomeComponents/UserCalendar/index.js", "max_forks_repo_name": "seanbelverstone/Bird-Bird-Ordering", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 34.1142857143, "max_line_length": 140, "alphanum_fraction": 0.7269681742}
import React from "react";
import DatePicker from "react-datepicker";
// Commented out until returning to full scope of orders.
// import addDays from "date-fns/subDays";
import setHours from "date-fns/setHours";
import setMinutes from "date-fns/setMinutes";
// import setDate from "date-fns/setDate";
// import setDay from "date-fns/setDay";
import "react-datepicker/dist/react-datepicker.css";
import "./style.css"; 

const UserCalendar = (props) => {

	return (
		<DatePicker
		id="datePicker"
		selected={props.pickupDateTime}
		onChange={props.handleCalendarChange}
		dateFormat="MMMM d, h:mm aa"
		// min date makes sure users can't select a date sooner than the day before Thanksgiving
		minDate={new Date(2020, 10, 25)}
		// when going back to full range, use addDays(new Date(), 2) as this will prevent users from selecting a day earlier than 2 days from now.
		// max date does the same, but for orders after thanksgiving day
		maxDate={new Date(2020, 10, 26)}
		showTimeSelect
		timeFormat="HH:mm"
		timeIntervals={15}
		timeCaption="Time"
		minTime={setHours(setMinutes(new Date(), 0), 9)}
		maxTime={setHours(setMinutes(new Date(), 0), 12)}
		/>
	);
}

export default UserCalendar;