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