Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date format does not use UTC #440

Closed
DerBasler opened this issue Jan 15, 2025 · 3 comments
Closed

Date format does not use UTC #440

DerBasler opened this issue Jan 15, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@DerBasler
Copy link
Contributor

DerBasler commented Jan 15, 2025

Current behaviour

// end date used as input
const date = new Date('2025-01-23T23:59:59.999Z');
console.log(new Intl.DateTimeFormat('de').format(date));
// shows "24.1.2025" so +1 then what it should

Expected behaviour

It should use utc and show the selected date in this case "23.1.2025"

How to reproduce?

  const myStart = new Date();
  myStart.setDate(22)
  // + 1 day and end of day
  const myEnd = new Date();
  myEnd.setDate(23)
  myEnd.setHours(23, 59, 59, 999); 

return (
<DatePickerModal
startDate={myStart}
endDate={myEnd}
visible={true}
locale='de'
mode="range"
onConfirm={()=>{}}
onDismiss={()=>{}}
/>);

Preview

image

What have you tried so far?

#441 (UTC is already used in \src\Time\TimePicker.tsx)

Your Environment

software version
ios x
android x
react-native x.x.x
react-native-paper x.x.x
node x.x.x
npm or yarn x.x.x
expo sdk x.x.x
@DerBasler DerBasler added the bug Something isn't working label Jan 15, 2025
DerBasler added a commit to DerBasler/react-native-paper-dates that referenced this issue Jan 15, 2025
@RichardLindhout
Copy link
Member

Thanks for your PR @DerBasler !

@DerBasler
Copy link
Contributor Author

My pleasure @RichardLindhout :) and thx for open sourcing it

@iM-GeeKy
Copy link
Collaborator

iM-GeeKy commented Jan 18, 2025

@RichardLindhout I assigned the pull request to you. Feel free to merge it.

RichardLindhout added a commit that referenced this issue Jan 27, 2025
fix: use UTC timeZone for Intl.DateTimeFormat #440
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants