Can I get today’s date plus one month in moment js? [duplicate]

<ion-datetime displayFormat=”MMMM YY” min=”{{min}}” max=”{{max}}”></ion-datetime> Now you need the min and max value. First, let find out today and next month. const today = moment(new Date()).format(‘YYYY-MM-DD’); const nextMonth = moment(today).add(1, ‘M’); var nextMonthEnd = moment(nextMonth).endOf(‘month’); if(today.date() != nextMonth.date() && nextMonth.isSame(nextMonthEnd.format(‘YYYY-MM-DD’))) { nextMonth = nextMonth.add(1, ‘d’); } console.log(today.format(‘DD-MM-YYYY’)); console.log(nextMonth.format(‘DD-MM-YYYY’)); Now this.min = this.today; this.max = this.nextMonth

Angular 2 – how round calculated number?

One can use angular built-in pipe such as number {{value | number:’1.0-0′}} If one wants to have an implementation of it: @Pipe({name: ’round’}) export class RoundPipe { transform (input:number) { return Math.floor(input); } } Use in the template {{1,1 | round}} => 1 {{2,1 | round}} => 2 Another useful pipe is a round ten … Read more

Why am I seeing a dropdown like thingy and need to “open” my Angular component in chrome

My colleague found the culprit, seems that ‘details‘ is a bad selector for an angular component… since HTML5 already contains a <details>-tag. So don’t use: @Component({ selector: ‘details’, templateUrl: ‘./details.component.html’, styleUrls: [‘./details.component.css’] }) rather use: @Component({ selector: ‘detailsWhatever’, templateUrl: ‘./details.component.html’, styleUrls: [‘./details.component.css’] }) Or any other selector that is not just ‘details’. Doh!

Displaying Tree view using Angular2

You need create a component that replies itself. So first thinking in data. You generally has an array of objects. This objects will have almost two properties “item” and “children”. “children” can be null or an object of the same type. ok? item1 item1-1 item2-1, item2-2 item1-2 item2 item3 item3-1 item3-2 item3-2-1 How you want … Read more