UNPKG

react-native-date-ranges-picker

Version:

This is a fork of react-native-date-ranges a bit more customizable

17 lines (15 loc) 579 B
export const dates = (startDate, endDate, focusedInput ) => { if (focusedInput === 'startDate') { if (startDate && endDate) { return ({ startDate, endDate: null, focusedInput: 'endDate' }); } return ({ startDate, endDate, focusedInput: 'endDate' }); } if (focusedInput === 'endDate') { if (endDate && startDate && endDate.isBefore(startDate)) { return ({ startDate: endDate, endDate: null, focusedInput: 'endDate' }); } return ({ startDate, endDate, focusedInput: 'startDate' }); } return ({ startDate, endDate, focusedInput }); };