Skip to content

Error on day selection (-1 day)Β #428

@Reggionick

Description

@Reggionick

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

I had an issue on some dates (I still don't know why this is not systematic) where the selected date was the day before today (-2 from UTC). In attachment a screenshot with the selected date with the difference from the highlighted one.

Screenshot 2024-10-24 at 22 53 19

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-paper-dates/src/Date/Day.tsx b/node_modules/react-native-paper-dates/src/Date/Day.tsx
index 56bcee6..fcf34ae 100644
--- a/node_modules/react-native-paper-dates/src/Date/Day.tsx
+++ b/node_modules/react-native-paper-dates/src/Date/Day.tsx
@@ -53,7 +53,7 @@ function Day(props: {
   const borderColor = theme.isV3 ? theme.colors.primary : v2BorderColor
 
   const onPress = useCallback(() => {
-    onPressDate(new Date(year, month, day))
+    onPressDate(new Date(Date.UTC(year, month, day)))
   }, [onPressDate, year, month, day])
 
   // TODO: check if this can be simplified

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions