Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ChartDataBase
- export class ChartDatabase {
- ......
- ......
- }
- // Home Component
- export class HomeComponent implements OnInit {
- ......
- dates: string[] = []; // all days in chart
- today = moment().format('YYYY-MM-DD');
- ......
- database.dataChange.subscribe((tree: Step) => {
- if (tree) {
- ......
- this.buildCalendar(tree);
- ......
- }
- });
- ......
- buildCalendar(step: Step) {
- const start = this.moment(step.dates.start);
- const end = this.moment(step.dates.end);
- const range = this.moment.range(start, end);
- const days = Array.from(range.by('days'));
- this.dates = days.map(d => d.format('YYYY-MM-DD'));
- }
- }
Add Comment
Please, Sign In to add comment