-
Notifications
You must be signed in to change notification settings - Fork 0
/
datetime-demo.component.ts
33 lines (31 loc) · 1.05 KB
/
datetime-demo.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Component } from '@angular/core';
import moment from 'moment-es6';
/* import { events } from './events'; */
@Component({
template: `
<h2>Datetime Component</h2>
<p>pop with calendar inside</p>
<ec-datetime></ec-datetime>
<h2>Calendar: {{ calendar.value }}</h2>
<p>controls + month grid inside</p>
<ec-calendar #calendar></ec-calendar>
<h2>Month Heatmap</h2>
<ec-heatmap [selectSpan]="selectSpan"
[disableDrag]="false" [disableDragAnywhere]="true" (spanChanged)="changedSpan($event)" [timestamps]="timestamps"></ec-heatmap>
<h2>Month</h2>
<p>Just month grid</p>
<ec-month #month></ec-month>
{{ month.date }}
`,
})
export class DatetimeDemoComponent {
timestamps;
selectSpan = [moment().subtract(2, 'months'), moment()];
constructor() {
/* this.timestamps = events.map(e => e.timestamp); */
this.timestamps = [moment().subtract(18, 'days'), moment().subtract(25, 'days')].map((d) => d.toISOString());
}
changedSpan(span) {
console.log('span', span.map((m) => m.toISOString()));
}
}