mirror of
https://github.com/encounter/react-add-to-calendar.git
synced 2026-07-10 21:18:44 -07:00
Adds Support for Outlook.com
This commit is contained in:
@@ -15,6 +15,7 @@ export default React.createClass({
|
||||
|
||||
let items = [
|
||||
{ outlook: 'Outlook' },
|
||||
{ outlookcom: 'Outlook.com' },
|
||||
{ apple: 'iCal' },
|
||||
{ yahoo: 'Yahoo!' },
|
||||
{ google: 'Google' }
|
||||
@@ -28,6 +29,8 @@ export default React.createClass({
|
||||
|
||||
{"\{ outlook: 'Outlook' \}"}<br/>
|
||||
|
||||
{"\{ outlookcom: 'Outlook.com' \}"}<br/>
|
||||
|
||||
{"\{ apple: 'iCal' \}"}<br/>
|
||||
|
||||
{"\{ yahoo: 'Yahoo!' \}"}<br/>
|
||||
|
||||
@@ -15,6 +15,7 @@ export default React.createClass({
|
||||
|
||||
let items = [
|
||||
{ outlook: 'Outlook' },
|
||||
{ outlookcom: 'Outlook.com' },
|
||||
{ apple: 'Apple Calendar' },
|
||||
{ yahoo: 'Yahoo' },
|
||||
{ google: 'Google' }
|
||||
@@ -28,6 +29,8 @@ export default React.createClass({
|
||||
|
||||
{"\{ outlook: 'Outlook' \}"}<br/>
|
||||
|
||||
{"\{ outlookcom: 'Outlook.com' \}"}<br/>
|
||||
|
||||
{"\{ apple: 'Apple Calendar' \}"}<br/>
|
||||
|
||||
{"\{ yahoo: 'Yahoo' \}"}<br/>
|
||||
|
||||
@@ -67,6 +67,7 @@ defaultValue: `[
|
||||
{ apple: 'Apple Calendar' },
|
||||
{ google: 'Google' },
|
||||
{ outlook: 'Outlook' },
|
||||
{ outlookcom: 'Outlook.com' },
|
||||
{ yahoo: 'Yahoo' }
|
||||
]`
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ export default class ReactAddToCalendar extends React.Component {
|
||||
|
||||
let icon = null;
|
||||
if (self.props.displayItemIcons) {
|
||||
let currentIcon = (currentItem === 'outlook') ? 'windows' : currentItem;
|
||||
let currentIcon = (currentItem === 'outlook' || currentItem === 'outlookcom') ? 'windows' : currentItem;
|
||||
icon = <i className={'fa fa-' + currentIcon}/>;
|
||||
}
|
||||
|
||||
@@ -187,7 +187,8 @@ ReactAddToCalendar.defaultProps = {
|
||||
{ apple: 'Apple Calendar' },
|
||||
{ google: 'Google' },
|
||||
{ outlook: 'Outlook' },
|
||||
{ yahoo: 'Yahoo' }
|
||||
{ outlookcom: 'Outlook.com' },
|
||||
{ yahoo: 'Yahoo' },
|
||||
],
|
||||
rootClass: 'react-add-to-calendar'
|
||||
};
|
||||
+14
-2
@@ -46,13 +46,25 @@ export default class helpers {
|
||||
// yahoo doesn't utilize endTime so we need to calulate duration
|
||||
let duration = this.calculateDuration(event.startTime, event.endTime);
|
||||
calendarUrl = 'https://calendar.yahoo.com/?v=60&view=d&type=20';
|
||||
calendarUrl += '&title=' + event.title;
|
||||
calendarUrl += '&title=' + encodeURIComponent(event.title);
|
||||
calendarUrl += '&st=' + this.formatTime(event.startTime);
|
||||
calendarUrl += '&dur=' + duration;
|
||||
calendarUrl += '&desc=' + event.description;
|
||||
calendarUrl += '&desc=' + encodeURIComponent(event.description);
|
||||
calendarUrl += '&in_loc=' + encodeURIComponent(event.location);
|
||||
break;
|
||||
|
||||
case 'outlookcom':
|
||||
calendarUrl = "https://outlook.live.com/owa/?rru=addevent";
|
||||
calendarUrl += "&startdt=" + this.formatTime(event.startTime);
|
||||
calendarUrl += "&enddt=" + this.formatTime(event.endTime);
|
||||
calendarUrl += "&subject=" + encodeURIComponent(event.title);
|
||||
calendarUrl += "&location=" + encodeURIComponent(event.location);
|
||||
calendarUrl += "&body=" + encodeURIComponent(event.description);
|
||||
calendarUrl += "&allday=false";
|
||||
calendarUrl += "&uid=" + this.getRandomKey();
|
||||
calendarUrl += "&path=/calendar/view/Month";
|
||||
break;
|
||||
|
||||
default:
|
||||
calendarUrl = [
|
||||
'BEGIN:VCALENDAR',
|
||||
|
||||
Reference in New Issue
Block a user