Event and task: show timezone information.

First steps towards #29.
master
Tom Hacohen 6 years ago
parent 172cc4ce53
commit 5237b14b74

@ -22,10 +22,12 @@ class Event extends React.PureComponent {
},
};
const timezone = this.props.item.timezone;
return (
<React.Fragment>
<PimItemHeader text={this.props.item.summary} backgroundColor={this.props.item.color}>
<div>{formatDateRange(this.props.item.startDate, this.props.item.endDate)}</div>
<div>{formatDateRange(this.props.item.startDate, this.props.item.endDate)} { timezone && <small>({timezone})</small>}</div>
<br/>
<div><u>{this.props.item.location}</u></div>
</PimItemHeader>

@ -24,14 +24,16 @@ class Task extends React.PureComponent {
},
};
const timezone = this.props.item.timezone;
return (
<React.Fragment>
<PimItemHeader text={this.props.item.summary} backgroundColor={this.props.item.color}>
{ item.startDate &&
<div>Start: {formatDate(item.startDate)}</div>
<div>Start: {formatDate(item.startDate)} { timezone && <small>({timezone})</small>}</div>
}
{ item.dueDate &&
<div>Due: {formatDate(item.dueDate)}</div>
<div>Due: {formatDate(item.dueDate)} { timezone && <small>({timezone})</small>}</div>
}
<br/>
<div><u>{this.props.item.location}</u></div>

@ -17,6 +17,16 @@ export class EventType extends ICAL.Event implements PimType {
return new EventType(comp.getFirstSubcomponent('vevent'));
}
get timezone() {
if (this.startDate) {
return this.startDate.timezone;
} else if (this.endDate) {
return this.endDate.timezone;
}
return null;
}
get title() {
return this.summary;
}

@ -70,6 +70,8 @@ declare module 'ical.js' {
class Time {
isDate: boolean;
timezone: string;
zone: Timezone;
static fromString(str: string): Time;
static fromJSDate(aDate: Date | null, useUTC: boolean): Time;
@ -102,4 +104,11 @@ declare module 'ical.js' {
next(): Time;
}
class Timezone {
static localTimezone: Timezone;
static convert_time(tt: Time, from_zone: Timezone, to_zone: Timezone): Time;
tzid: string;
}
}

Loading…
Cancel
Save