Skip to content

Commit

Permalink
fix(Event): Append address to LOCATION even without radius / geo
Browse files Browse the repository at this point in the history
closes #314
  • Loading branch information
sebbo2002 committed Sep 20, 2021
1 parent fb7a930 commit 09ea62e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1448,21 +1448,18 @@ export default class ICalEvent {

// LOCATION
if (this.data.location?.title) {
if (this.data.location.radius && this.data.location.geo) {
g += 'LOCATION:' + escape(
this.data.location.title +
(this.data.location.address ? '\n' + this.data.location.address : '')
) + '\r\n';
g += 'LOCATION:' + escape(
this.data.location.title +
(this.data.location.address ? '\n' + this.data.location.address : '')
) + '\r\n';

if (this.data.location.radius && this.data.location.geo) {
g += 'X-APPLE-STRUCTURED-LOCATION;VALUE=URI;' +
(this.data.location.address ? 'X-ADDRESS=' + escape(this.data.location.address) + ';' : '') +
'X-APPLE-RADIUS=' + escape(this.data.location.radius) + ';' +
'X-TITLE=' + escape(this.data.location.title) +
':geo:' + escape(this.data.location.geo?.lat) + ',' + escape(this.data.location.geo?.lon) + '\r\n';
}
else {
g += 'LOCATION:' + escape(this.data.location.title) + '\r\n';
}

if (this.data.location.geo) {
g += 'GEO:' + escape(this.data.location.geo?.lat) + ';' + escape(this.data.location.geo?.lon) + '\r\n';
Expand Down

0 comments on commit 09ea62e

Please sign in to comment.