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

Value Prop Error #912

Open
SlashStars1 opened this issue Jun 20, 2024 · 0 comments
Open

Value Prop Error #912

SlashStars1 opened this issue Jun 20, 2024 · 0 comments

Comments

@SlashStars1
Copy link

Question

I'm getting an error saying that the value prop must be an instance of the date. I'm confused because it is???

`import { StyleSheet, Text, View } from 'react-native'
import React, {useState} from 'react'
import DateTimePicker from '@react-native-community/datetimepicker';

const setup = () => {

//6 AM original time
const initialTime = new Date();
initialTime.setHours(9);
initialTime.setMinutes(30);

const [time, setTime] = useState(initialTime);

  
const onChange=(selectedTime)=>{


  const actualTime = selectedTime || initialTime; //in case the user wants the default time,
  setTime(actualTime);
}

return (

<View>
  <Text>Setup</Text>
  <Text>What time do you want to be notified to set your 3 priorities for the day?</Text>
  <DateTimePicker
    testID="dateTimePicker"
    value={time}
    mode="time"
    display="default"
    onChange={onChange}
  />
</View>

)
}

export default setup

const styles = StyleSheet.create({})`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant