-
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 3 commits
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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')}`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This project is not just for India There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my mistake |
||
} | ||
|
||
get calender() { | ||
iamareebjamal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need of this helper. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ohk |
||
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="ui list basic segment"> | ||
<div class="content"> | ||
<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,26 @@ | ||
import { module, test } from 'qunit'; | ||
import { setupRenderingTest } from 'ember-qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import hbs from 'htmlbars-inline-precompile'; | ||
|
||
module('Integration | Component | public/add-to-calender', function(hooks) { | ||
setupRenderingTest(hooks); | ||
|
||
test('it renders', async function(assert) { | ||
// Set any properties with this.set('myProperty', 'value'); | ||
// Handle any actions with this.set('myAction', function(val) { ... }); | ||
|
||
await render(hbs`{{public/add-to-calender}}`); | ||
|
||
assert.equal(this.element.textContent.trim(), ''); | ||
|
||
// Template block usage: | ||
await render(hbs` | ||
{{#public/add-to-calender}} | ||
template block text | ||
{{/public/add-to-calender}} | ||
`); | ||
|
||
assert.equal(this.element.textContent.trim(), 'template block text'); | ||
}); | ||
}); |
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.