Skip to content

Commit a9da6c8

Browse files
fix: conflicts and linting
1 parent 4c7cacd commit a9da6c8

File tree

6 files changed

+16
-22
lines changed

6 files changed

+16
-22
lines changed

example/src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,10 @@ export default function App() {
190190
startDate={range.startDate}
191191
endDate={range.endDate}
192192
dates={dates}
193-
//isDateDisabled={(date) => [0, 6].includes(dayjs(date).day())} // disable weekends
194193
//minDate={dayjs().startOf('day')}
195194
//maxDate={dayjs().add(3, 'day').endOf('day')}
196195
//disabledDates={[dayjs(), dayjs().add(1, 'day')]}
197-
//disabledDates={(date) => [0, 6].includes(dayjs(date).day())}// disable weekends
196+
//disabledDates={(date) => [0, 6].includes(dayjs(date).day())} // disable weekends
198197
//firstDayOfWeek={1}
199198
displayFullDays
200199
timePicker={timePicker}

src/DateTimePicker.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,11 @@ const DateTimePicker = (
8181
onChange,
8282
initialView = 'day',
8383
height,
84-
isDateDisabled,
8584
...rest
8685
} = props;
8786

87+
dayjs.locale(locale);
88+
8889
const initialCalendarView: CalendarViews =
8990
mode !== 'single' && initialView === 'time' ? 'day' : initialView;
9091

@@ -113,8 +114,6 @@ const DateTimePicker = (
113114

114115
let currentYear = currentDate.year();
115116

116-
dayjs.locale(locale);
117-
118117
const [state, dispatch] = useReducer(
119118
(prevState: LocalState, action: CalendarAction) => {
120119
switch (action.type) {
@@ -310,7 +309,6 @@ const DateTimePicker = (
310309
onSelectYear,
311310
onChangeMonth,
312311
onChangeYear,
313-
isDateDisabled,
314312
}}
315313
>
316314
<Calendar

src/components/DaySelector.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ const DaySelector = () => {
5050
minDate,
5151
maxDate,
5252
firstDayOfWeek,
53-
disabledDates,
54-
firstDayOfWeek
53+
disabledDates
5554
).map((day, index) => {
5655
if (day) {
5756
let leftCrop = day.dayOfMonth === 1;
5857
let rightCrop = day.dayOfMonth === fullDaysInMonth;
5958

6059
const isFirstDayOfMonth = day.dayOfMonth === 1;
61-
const isLastDayOfMonth = ((day?.dayOfMonth || 0) - ((day?.dayOfMonth || 0) - day.day)) === fullDaysInMonth;
60+
const isLastDayOfMonth =
61+
(day?.dayOfMonth || 0) - ((day?.dayOfMonth || 0) - day.day) ===
62+
fullDaysInMonth;
6263

6364
const isToday = areDatesOnSameDay(day.date, today);
6465
let inRange = false;
@@ -90,7 +91,8 @@ const DaySelector = () => {
9091
if (
9192
(isFirstDayOfMonth && selectedEndDay) ||
9293
(isLastDayOfMonth && selectedStartDay) ||
93-
dayjs(startDate).format('DDMMYYYY') === dayjs(endDate).format('DDMMYYYY')
94+
dayjs(startDate).format('DDMMYYYY') ===
95+
dayjs(endDate).format('DDMMYYYY')
9496
) {
9597
inRange = false;
9698
}

src/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ const Header = ({ buttonPrevIcon, buttonNextIcon }: HeaderProps) => {
104104
<View style={[styles.textContainer, theme?.headerTextContainerStyle]}>
105105
<Text style={[styles.text, theme?.headerTextStyle]}>
106106
{calendarView === 'year'
107-
? `${years[0]} - ${years[years.length-1]}`
107+
? `${years[0]} - ${years[years.length - 1]}`
108108
: dayjs(currentDate).format('YYYY')}
109109
</Text>
110110
</View>
File renamed without changes.

src/utils.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import dayjs from 'dayjs';
2-
import type { DatePickerBaseProps, DateType, IDayObject } from './types';
2+
import type { DateType, IDayObject } from './types';
33

44
export const CALENDAR_FORMAT = 'YYYY-MM-DD HH:mm';
55
export const DATE_FORMAT = 'YYYY-MM-DD';
@@ -189,8 +189,7 @@ export const getMonthDays = (
189189
minDate: DateType,
190190
maxDate: DateType,
191191
firstDayOfWeek: number,
192-
disabledDates: DateType[] | ((date: DateType) => boolean) | undefined,
193-
firstDayOfWeek: number
192+
disabledDates: DateType[] | ((date: DateType) => boolean) | undefined
194193
): IDayObject[] => {
195194
const date = getDate(datetime);
196195
const {
@@ -211,8 +210,7 @@ export const getMonthDays = (
211210
maxDate,
212211
disabledDates,
213212
false,
214-
index + 1,
215-
isDateDisabled
213+
index + 1
216214
);
217215
})
218216
: Array(prevMonthOffset).fill(null);
@@ -227,8 +225,7 @@ export const getMonthDays = (
227225
maxDate,
228226
disabledDates,
229227
true,
230-
prevMonthOffset + day,
231-
isDateDisabled
228+
prevMonthOffset + day
232229
);
233230
});
234231

@@ -242,8 +239,7 @@ export const getMonthDays = (
242239
maxDate,
243240
disabledDates,
244241
false,
245-
daysInCurrentMonth + prevMonthOffset + day,
246-
isDateDisabled
242+
daysInCurrentMonth + prevMonthOffset + day
247243
);
248244
});
249245

@@ -269,8 +265,7 @@ const generateDayObject = (
269265
maxDate: DateType,
270266
disabledDates: DateType[] | ((date: DateType) => boolean) | undefined,
271267
isCurrentMonth: boolean,
272-
dayOfMonth: number,
273-
isDateDisabled?: DatePickerBaseProps['isDateDisabled']
268+
dayOfMonth: number
274269
) => {
275270
return {
276271
text: day.toString(),

0 commit comments

Comments
 (0)