Skip to content

Commit

Permalink
perf|docs: change exports, fix broken link in the README
Browse files Browse the repository at this point in the history
  • Loading branch information
Feshchenko committed Nov 30, 2023
1 parent 1fb594b commit 8d51e2b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ yarn add @rehookify/datepicker
pnpm add @rehookify/datepicker
```

Start with [tutorials](https://rehookify.com/tutorials)
Start with [tutorials](https://rehookify.com/datepicker/tutorials)
2 changes: 1 addition & 1 deletion packages/datepicker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ yarn add @rehookify/datepicker
pnpm add @rehookify/datepicker
```

Start with [tutorials](https://rehookify.com/tutorials)
Start with [tutorials](https://rehookify.com/datepicker/tutorials)
2 changes: 1 addition & 1 deletion packages/datepicker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rehookify/datepicker",
"version": "6.4.0",
"version": "6.4.1",
"description": "The ultimate tool to create a date, range and time picker in your React applications.",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.mjs",
Expand Down
6 changes: 2 additions & 4 deletions packages/datepicker/src/date-picker-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ var DatePickerContext = createContext<DatePickerContextValue>(
{} as DatePickerContextValue,
);

var useDatePickerContext = () => useContext(DatePickerContext);
export var useDatePickerContext = () => useContext(DatePickerContext);

function DatePickerProvider({
export function DatePickerProvider({
children,
config,
}: DatePickerProviderProps): ReactNode {
Expand All @@ -19,5 +19,3 @@ function DatePickerProvider({
</DatePickerContext.Provider>
);
}

export { DatePickerProvider, useDatePickerContext };
6 changes: 2 additions & 4 deletions packages/datepicker/src/date-picker-state-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { useDatePickerState } from './use-date-picker-state';

var DatePickerStateContext = createContext<DPState>({} as DPState);

var useDatePickerStateContext = () => useContext(DatePickerStateContext);
export var useDatePickerStateContext = () => useContext(DatePickerStateContext);

function DatePickerStateProvider({
export function DatePickerStateProvider({
children,
config,
}: DatePickerProviderProps): ReactNode {
Expand All @@ -17,5 +17,3 @@ function DatePickerStateProvider({
</DatePickerStateContext.Provider>
);
}

export { DatePickerStateProvider, useDatePickerStateContext };
14 changes: 8 additions & 6 deletions packages/datepicker/src/utils/get-calendar-month-params.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import type { DPCalendarConfig } from '../types';
import { daysInMonth, getDay, newDate } from './date';

const getStartOffset = (d: Date, startDay: number): number =>
(getDay(d) + 7 - startDay) % 7;
var NUMBER_OF_STATIC_CALENDAR_DAYS = 42;

export const getCalendarMonthParams = (
function getStartOffset(d: Date, startDay: number): number {
return (getDay(d) + 7 - startDay) % 7;
}

export function getCalendarMonthParams(
month: number,
year: number,
{ mode, startDay }: DPCalendarConfig,
): {
start: number;
length: number;
} => {
var NUMBER_OF_STATIC_CALENDAR_DAYS = 42;
} {
const firstMonthDay = newDate(year, month, 1);
const lastDay = daysInMonth(firstMonthDay);

Expand All @@ -30,4 +32,4 @@ export const getCalendarMonthParams = (
start: startOffset,
length,
};
};
}

0 comments on commit 8d51e2b

Please sign in to comment.