mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-28 03:43:28 +10:00
Refactor day type check function
This commit is contained in:
parent
4be615c352
commit
4e37f80482
1 changed files with 6 additions and 9 deletions
|
|
@ -107,16 +107,13 @@ const defaultProps = {
|
|||
|
||||
// Checks if time slot (propTypes.timeSlot) start time equals a day (moment)
|
||||
const timeSlotEqualsDay = (timeSlot, day) => {
|
||||
if (ensureTimeSlot(timeSlot).attributes.type === TIME_SLOT_DAY) {
|
||||
// Time slots describe available dates by providing a start and
|
||||
// an end date which is the following day. In the single date picker
|
||||
// the start date is used to represent available dates.
|
||||
const localStartDate = dateFromAPIToLocalNoon(timeSlot.attributes.start);
|
||||
// Time slots describe available dates by providing a start and
|
||||
// an end date which is the following day. In the single date picker
|
||||
// the start date is used to represent available dates.
|
||||
const localStartDate = dateFromAPIToLocalNoon(timeSlot.attributes.start);
|
||||
|
||||
return isSameDay(day, moment(localStartDate));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
const isDay = ensureTimeSlot(timeSlot).attributes.type === TIME_SLOT_DAY;
|
||||
return isDay && isSameDay(day, moment(localStartDate));
|
||||
};
|
||||
|
||||
class DateInputComponent extends Component {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue