From 68baad1e6d17427c9a95986c4e4c7e15d50e000b Mon Sep 17 00:00:00 2001 From: Joachim Date: Sat, 13 Jan 2024 01:31:31 +0000 Subject: [PATCH] Individual imports of date-fns + 8.0.0 release (#361) Co-authored-by: Joachim --- CalendarPicker/Day.js | 8 +++++++- CalendarPicker/DaysGridView.js | 3 ++- CalendarPicker/Month.js | 4 +++- CalendarPicker/Scroller.js | 8 +++++++- CalendarPicker/Utils.js | 5 ++++- CalendarPicker/Year.js | 7 ++++++- CalendarPicker/YearsHeader.js | 3 ++- CalendarPicker/index.js | 11 ++++++++++- example/example/App.js | 6 +++++- package.json | 2 +- 10 files changed, 47 insertions(+), 10 deletions(-) diff --git a/CalendarPicker/Day.js b/CalendarPicker/Day.js index 9eeba38..8f72c6f 100644 --- a/CalendarPicker/Day.js +++ b/CalendarPicker/Day.js @@ -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 { diff --git a/CalendarPicker/DaysGridView.js b/CalendarPicker/DaysGridView.js index 3ad7ef7..46d116b 100644 --- a/CalendarPicker/DaysGridView.js +++ b/CalendarPicker/DaysGridView.js @@ -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) { diff --git a/CalendarPicker/Month.js b/CalendarPicker/Month.js index 05b0742..f19f2ee 100644 --- a/CalendarPicker/Month.js +++ b/CalendarPicker/Month.js @@ -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 { diff --git a/CalendarPicker/Scroller.js b/CalendarPicker/Scroller.js index 274ea83..7330993 100644 --- a/CalendarPicker/Scroller.js +++ b/CalendarPicker/Scroller.js @@ -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 = { diff --git a/CalendarPicker/Utils.js b/CalendarPicker/Utils.js index ad65ad8..20958de 100644 --- a/CalendarPicker/Utils.js +++ b/CalendarPicker/Utils.js @@ -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', diff --git a/CalendarPicker/Year.js b/CalendarPicker/Year.js index 2febf70..027b256 100644 --- a/CalendarPicker/Year.js +++ b/CalendarPicker/Year.js @@ -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 { diff --git a/CalendarPicker/YearsHeader.js b/CalendarPicker/YearsHeader.js index 76044a2..3592a49 100644 --- a/CalendarPicker/YearsHeader.js +++ b/CalendarPicker/YearsHeader.js @@ -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 { diff --git a/CalendarPicker/index.js b/CalendarPicker/index.js index 44ddc4a..e9265a8 100644 --- a/CalendarPicker/index.js +++ b/CalendarPicker/index.js @@ -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) { diff --git a/example/example/App.js b/example/example/App.js index b31676d..b2f2173 100644 --- a/example/example/App.js +++ b/example/example/App.js @@ -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 { diff --git a/package.json b/package.json index 6aa61c6..4af5ad2 100644 --- a/package.json +++ b/package.json @@ -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"