maxdate update student and teacher
This commit is contained in:
parent
7dba6d1555
commit
bda8fc8bf1
|
@ -226,13 +226,16 @@ class StudentCreate extends React.Component<any, any>{
|
||||||
showDatePicker = () => this.setState({ isDatePickerVisible: true });
|
showDatePicker = () => this.setState({ isDatePickerVisible: true });
|
||||||
hideDatePicker = () => this.setState({ isDatePickerVisible: false });
|
hideDatePicker = () => this.setState({ isDatePickerVisible: false });
|
||||||
|
|
||||||
handleConfirm = (date: any, setFieldValue: any) => {
|
handleConfirm = async (date: any, setFieldValue: any) => {
|
||||||
|
await this.hideDatePicker();
|
||||||
setFieldValue('date_of_birth', date.toISOString().split('T')[0]);
|
setFieldValue('date_of_birth', date.toISOString().split('T')[0]);
|
||||||
this.hideDatePicker();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
|
var date = new Date();
|
||||||
|
date.setDate(date.getDate() - 1);
|
||||||
|
|
||||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||||
|
|
||||||
<Text style={BaseStyles.topHeader}>Add Student</Text>
|
<Text style={BaseStyles.topHeader}>Add Student</Text>
|
||||||
|
@ -368,6 +371,7 @@ class StudentCreate extends React.Component<any, any>{
|
||||||
mode="date"
|
mode="date"
|
||||||
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
||||||
onCancel={this.hideDatePicker}
|
onCancel={this.hideDatePicker}
|
||||||
|
maximumDate={date}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View style={[styles.container]}>
|
<View style={[styles.container]}>
|
||||||
|
|
|
@ -216,9 +216,9 @@ class StudentUpdate extends React.Component<any, any>{
|
||||||
showDatePicker = () => this.setState({ isDatePickerVisible: true });
|
showDatePicker = () => this.setState({ isDatePickerVisible: true });
|
||||||
hideDatePicker = () => this.setState({ isDatePickerVisible: false });
|
hideDatePicker = () => this.setState({ isDatePickerVisible: false });
|
||||||
|
|
||||||
handleConfirm = (date: any, setFieldValue: any) => {
|
handleConfirm = async (date: any, setFieldValue: any) => {
|
||||||
|
await this.hideDatePicker();
|
||||||
setFieldValue('date_of_birth', date.toISOString().split('T')[0]);
|
setFieldValue('date_of_birth', date.toISOString().split('T')[0]);
|
||||||
this.hideDatePicker();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -234,6 +234,9 @@ class StudentUpdate extends React.Component<any, any>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var date = new Date();
|
||||||
|
date.setDate(date.getDate() - 1);
|
||||||
|
|
||||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||||
|
|
||||||
<Text style={BaseStyles.topHeader}>Update Student</Text>
|
<Text style={BaseStyles.topHeader}>Update Student</Text>
|
||||||
|
@ -373,6 +376,8 @@ class StudentUpdate extends React.Component<any, any>{
|
||||||
mode="date"
|
mode="date"
|
||||||
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
||||||
onCancel={this.hideDatePicker}
|
onCancel={this.hideDatePicker}
|
||||||
|
date={values.date_of_birth ? new Date(values.date_of_birth) : new Date()}
|
||||||
|
maximumDate={date}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View style={[styles.container]}>
|
<View style={[styles.container]}>
|
||||||
|
|
|
@ -91,6 +91,8 @@ class TeacherCreate extends React.Component<any, any>{
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
var date = new Date();
|
||||||
|
date.setDate(date.getDate() - 1);
|
||||||
|
|
||||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||||
|
|
||||||
|
@ -155,6 +157,7 @@ class TeacherCreate extends React.Component<any, any>{
|
||||||
mode="date"
|
mode="date"
|
||||||
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
||||||
onCancel={this.hideDatePicker}
|
onCancel={this.hideDatePicker}
|
||||||
|
maximumDate={date}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View style={[styles.container]}>
|
<View style={[styles.container]}>
|
||||||
|
|
|
@ -112,9 +112,11 @@ class TeacherUpdate extends React.Component<any, any>{
|
||||||
phoneNumber = this.props.route.params.data.phone_number
|
phoneNumber = this.props.route.params.data.phone_number
|
||||||
emailId = this.props.route.params.data.email_id
|
emailId = this.props.route.params.data.email_id
|
||||||
imageInput = this.props.route.params.data.image,
|
imageInput = this.props.route.params.data.image,
|
||||||
date_of_birth = this.props.route.params.data.date_of_birth
|
date_of_birth = this.props.info.data.date_of_birth
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var date = new Date();
|
||||||
|
date.setDate(date.getDate() - 1);
|
||||||
|
|
||||||
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
return (<View style={[AppStyles.containerWoPadding, {}]}>
|
||||||
|
|
||||||
|
@ -133,7 +135,7 @@ class TeacherUpdate extends React.Component<any, any>{
|
||||||
phone_number: phoneNumber,
|
phone_number: phoneNumber,
|
||||||
email_id: emailId,
|
email_id: emailId,
|
||||||
image:imageInput,
|
image:imageInput,
|
||||||
date_of_birth: ''
|
date_of_birth: date_of_birth
|
||||||
}}
|
}}
|
||||||
onSubmit={(values, actions) => this.onTeacherUpdate(values, actions)}
|
onSubmit={(values, actions) => this.onTeacherUpdate(values, actions)}
|
||||||
>
|
>
|
||||||
|
@ -181,6 +183,8 @@ class TeacherUpdate extends React.Component<any, any>{
|
||||||
mode="date"
|
mode="date"
|
||||||
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
onConfirm={(date) => this.handleConfirm(date, setFieldValue)}
|
||||||
onCancel={this.hideDatePicker}
|
onCancel={this.hideDatePicker}
|
||||||
|
date={values.date_of_birth ? new Date(values.date_of_birth) : new Date()}
|
||||||
|
maximumDate={date}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View style={[styles.container]}>
|
<View style={[styles.container]}>
|
||||||
|
|
Loading…
Reference in New Issue