-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Add to Google Calendar #5392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
906a2bb
0a50938
f8100f0
ebadc8d
d258d8b
990da57
7d4fa22
146f940
603a58d
60c3027
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,18 @@ import Component from '@glimmer/component'; | |
| import moment from 'moment'; | ||
|
|
||
| export default class AddToCalender extends Component { | ||
| params = this.args.event; | ||
|
|
||
| get timezone() { | ||
| return `GMT${moment.tz("Asia/Kolkata").format('Z')}`; | ||
|
||
| } | ||
|
|
||
| get calender() { | ||
iamareebjamal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const params = this.args.event; | ||
| const startparams = params.startsAt; | ||
| const timezone=params.timezone; | ||
| const endparams = params.endsAt; | ||
| const starttime = moment(startparams).tz(timezone).utc().format('YYYYMMDD[T]HHmmSS[Z]'); | ||
| const endtime = moment(endparams).tz(timezone).utc().format('YYYYMMDD[T]HHmmSS[Z]'); | ||
| return `https://calendar.google.com/calendar/u/0/r/eventedit?dates=${starttime}/${endtime}&text=${params.name}&location=${this.args.eventlocation}&sf=true`; | ||
| const startparams = this.params.startsAt; | ||
| const endparams = this.params.endsAt; | ||
| const starttime = moment(startparams).tz(this.params.timezone).utc().format('YYYYMMDD[T]HHmmSS[Z]'); | ||
| const endtime = moment(endparams).tz(this.params.timezone).utc().format('YYYYMMDD[T]HHmmSS[Z]'); | ||
| return `https://calendar.google.com/calendar/u/0/r/eventedit?dates=${starttime}/${endtime}&text=${this.params.name}&location=${this.args.eventlocation}&sf=true`; | ||
iamareebjamal marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import Helper from '@ember/component/helper'; | ||
| import moment from 'moment'; | ||
|
|
||
| export function calenderDate(params) { | ||
|
||
| const timezone = params[1] ? params[1] : moment.tz.guess(); | ||
| return `${moment(params[0]).tz(timezone).format('dddd, MMMM DD, YYYY h:mm A')}`; | ||
| } | ||
|
|
||
| export default Helper.helper(calenderDate); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| <div class="ui list basic segment"> | ||
| <div class="content"> | ||
| <li>{{general-date @event.startsAt}} To {{general-date @event.endsAt}}</li> | ||
| <li>{{calender-date this.params.startsAt}} To {{calender-date this.params.endsAt}} {{this.timezone}}</li> | ||
| <i class="calendar alternate outline icon"></i><a href={{this.calender}}>Add To Calender</a> | ||
| </div> | ||
| </div> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { module, test } from 'qunit'; | ||
| import { setupRenderingTest } from 'ember-qunit'; | ||
| import { render } from '@ember/test-helpers'; | ||
| import hbs from 'htmlbars-inline-precompile'; | ||
|
|
||
| module('Integration | Helper | calender-date', function(hooks) { | ||
| setupRenderingTest(hooks); | ||
|
|
||
| // Replace this with your real tests. | ||
| test('it renders', async function(assert) { | ||
| this.set('inputValue', '1234'); | ||
|
|
||
| await render(hbs`{{calender-date inputValue}}`); | ||
|
|
||
| assert.equal(this.element.textContent.trim(), '1234'); | ||
| }); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.