|
|
@ -24,6 +24,8 @@ class EventEdit extends React.Component {
|
|
|
|
location: string;
|
|
|
|
location: string;
|
|
|
|
description: string;
|
|
|
|
description: string;
|
|
|
|
journalUid: string;
|
|
|
|
journalUid: string;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error?: string;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
props: {
|
|
|
|
props: {
|
|
|
@ -41,9 +43,10 @@ class EventEdit extends React.Component {
|
|
|
|
allDay: false,
|
|
|
|
allDay: false,
|
|
|
|
location: '',
|
|
|
|
location: '',
|
|
|
|
description: '',
|
|
|
|
description: '',
|
|
|
|
journalUid: '',
|
|
|
|
|
|
|
|
start: '',
|
|
|
|
start: '',
|
|
|
|
end: ''
|
|
|
|
end: '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
journalUid: '',
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (this.props.event !== undefined) {
|
|
|
|
if (this.props.event !== undefined) {
|
|
|
|
const event = this.props.event;
|
|
|
|
const event = this.props.event;
|
|
|
@ -110,12 +113,14 @@ class EventEdit extends React.Component {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
|
|
|
|
if ((this.state.start === '') || (this.state.end === '')) {
|
|
|
|
if ((this.state.start === '') || (this.state.end === '')) {
|
|
|
|
|
|
|
|
this.setState({error: 'Both start and end time must be set!'});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const startDate = ICAL.Time.fromString(this.state.start);
|
|
|
|
const startDate = ICAL.Time.fromString(this.state.start);
|
|
|
|
let endDate = ICAL.Time.fromString(this.state.end);
|
|
|
|
let endDate = ICAL.Time.fromString(this.state.end);
|
|
|
|
|
|
|
|
|
|
|
|
if (startDate.compare(endDate) >= 0) {
|
|
|
|
if (startDate.compare(endDate) >= 0) {
|
|
|
|
|
|
|
|
this.setState({error: 'End time must be later than start time!'});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -159,6 +164,9 @@ class EventEdit extends React.Component {
|
|
|
|
<h2>
|
|
|
|
<h2>
|
|
|
|
{this.props.event ? 'Edit Event' : 'New Event'}
|
|
|
|
{this.props.event ? 'Edit Event' : 'New Event'}
|
|
|
|
</h2>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
{this.state.error && (
|
|
|
|
|
|
|
|
<div>ERROR! {this.state.error}</div>
|
|
|
|
|
|
|
|
)}
|
|
|
|
<form style={styles.form} onSubmit={this.onSubmit}>
|
|
|
|
<form style={styles.form} onSubmit={this.onSubmit}>
|
|
|
|
<TextField
|
|
|
|
<TextField
|
|
|
|
name="title"
|
|
|
|
name="title"
|
|
|
|