Skip to content

Commit

Permalink
Individual imports of date-fns + 8.0.0 release (#361)
Browse files Browse the repository at this point in the history
Co-authored-by: Joachim <[email protected]>
  • Loading branch information
tranjog and Joachim authored Jan 13, 2024
1 parent 724e33f commit 68baad1
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 10 deletions.
8 changes: 7 additions & 1 deletion CalendarPicker/Day.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import {
TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import { differenceInDays, isAfter, isBefore, isSameDay, isWithinInterval, startOfDay } from 'date-fns';

import { differenceInDays } from 'date-fns/differenceInDays';
import { isAfter } from 'date-fns/isAfter';
import { isBefore } from 'date-fns/isBefore';
import { isSameDay } from 'date-fns/isSameDay';
import { isWithinInterval } from 'date-fns/isWithinInterval';
import { startOfDay } from 'date-fns/startOfDay';

export default function Day(props) {
const {
Expand Down
3 changes: 2 additions & 1 deletion CalendarPicker/DaysGridView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { stylePropType } from './localPropTypes';
import Day from './Day';
import EmptyDay from './EmptyDay';
import { Utils } from './Utils';
import { getISODay } from 'date-fns';

import { getISODay } from 'date-fns/getISODay';

export default class DaysGridView extends Component {
constructor(props) {
Expand Down
4 changes: 3 additions & 1 deletion CalendarPicker/Month.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
} from 'react-native';
import PropTypes from 'prop-types';
import { Utils } from './Utils';
import { getMonth, getYear } from 'date-fns';

import { getMonth } from 'date-fns/getMonth';
import { getYear } from 'date-fns/getYear';

export default function Month(props) {
const {
Expand Down
8 changes: 7 additions & 1 deletion CalendarPicker/Scroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import React, { Component } from 'react';
import { View, Platform } from 'react-native';
import PropTypes from 'prop-types';
import { RecyclerListView, DataProvider, LayoutProvider } from 'recyclerlistview';
import { addMonths, endOfMonth, isAfter, isBefore, isSameMonth, startOfMonth } from 'date-fns';

import { addMonths } from 'date-fns/addMonths';
import { endOfMonth } from 'date-fns/endOfMonth';
import { isAfter } from 'date-fns/isAfter';
import { isBefore } from 'date-fns/isBefore';
import { isSameMonth } from 'date-fns/isSameMonth';
import { startOfMonth } from 'date-fns/startOfMonth';

export default class CalendarScroller extends Component {
static propTypes = {
Expand Down
5 changes: 4 additions & 1 deletion CalendarPicker/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
* Licensed under the terms of the MIT license. See LICENSE file in the project root for terms.
*/

import { getMonth, getYear, isSameDay, isSameMonth } from "date-fns";
import { getMonth } from 'date-fns/getMonth';
import { getYear } from 'date-fns/getYear';
import { isSameDay } from 'date-fns/isSameDay';
import { isSameMonth } from 'date-fns/isSameMonth';

export const Utils = {
START_DATE: 'START_DATE',
Expand Down
7 changes: 6 additions & 1 deletion CalendarPicker/Year.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import {
TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import { getMonth, getYear, isAfter, isBefore, startOfMonth } from 'date-fns';

import { getMonth } from 'date-fns/getMonth';
import { getYear } from 'date-fns/getYear';
import { isAfter } from 'date-fns/isAfter';
import { isBefore } from 'date-fns/isBefore';
import { startOfMonth } from 'date-fns/startOfMonth';

export default function Year(props) {
const {
Expand Down
3 changes: 2 additions & 1 deletion CalendarPicker/YearsHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
import PropTypes from 'prop-types';
import { stylePropType } from './localPropTypes';
import Controls from './Controls';
import { getYear } from 'date-fns';

import { getYear } from 'date-fns/getYear';

export default function YearsHeader(props) {
const {
Expand Down
11 changes: 10 additions & 1 deletion CalendarPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ import DaysGridView from './DaysGridView';
import MonthSelector from './MonthSelector';
import YearSelector from './YearSelector';
import Scroller from './Scroller';
import { addMonths, getMonth, getYear, isAfter, isBefore, isSameDay, isSameMonth, startOfMonth, subMonths } from 'date-fns';

import { addMonths } from 'date-fns/addMonths';
import { getMonth } from 'date-fns/getMonth';
import { getYear } from 'date-fns/getYear';
import { isAfter } from 'date-fns/isAfter';
import { isBefore } from 'date-fns/isBefore';
import { isSameDay } from 'date-fns/isSameDay';
import { isSameMonth } from 'date-fns/isSameMonth';
import { startOfMonth } from 'date-fns/startOfMonth';
import { subMonths } from 'date-fns/subMonths';

export default class CalendarPicker extends Component {
constructor(props) {
Expand Down
6 changes: 5 additions & 1 deletion example/example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
TextInput,
Switch,
} from 'react-native';
import { addDays, format, subDays } from 'date-fns';

import { addDays } from 'date-fns/addDays';
import { format } from 'date-fns/format';
import { subDays } from 'date-fns/subDays';

import CalendarPicker from './CalendarPicker';

export default class App extends Component {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-calendar-picker",
"version": "8.0.0-alpha",
"version": "8.0.0",
"description": "Calendar Picker Component for React Native",
"engines": {
"node": ">=4.0.0"
Expand Down

0 comments on commit 68baad1

Please sign in to comment.