title: Right way to return true/false in boolean TypeScript/JavaScript method?
body: <p>I'm trying to disable all the dates where user already has a booked event on. 
  I'm using <a href="https://www.npmjs.com/package/ng-pick-datetime" rel="nofollow noreferrer">https://www.npmjs.com/package/ng-pick-datetime</a> TypeScript and Angular 6. I'm more comfortable with Java but learning some Javascript on my own.</p>
  
  <p><strong>.TS</strong> </p>
  
  <pre><code>    getUserEvents() {
      this._calendarService.getAllEvent().subscribe(res =&gt; {
        this.allEvents = res.json();
      });
    }
  
    filterForbiddenDays() {
      this.allEvents.forEach(d =&gt; {
        let day = {
          'start': new Date(d.startDate.value),
          'end': new Date(d.endDate.value)
        };
        this.forbiddenDays.push(day);
      });
    }
  
    public myFilter = (d: Date): boolean =&gt; {
      //return this.forbiddenDays[0].start.getDate() !== d.getDate() &amp;&amp; this.forbiddenDays[1].start.getDate() !== d.getDate() // &lt;-- THIS WORKS GREAT
      this.forbiddenDays.filter(data =&gt; {
        return data.start.getDate() !== d.getDate() // &lt;-- TRUE SHOULD CHANGE COLOR ON DAY IN CALENDAR
      });
      return false;
    }
  </code></pre>
  
  <p>If I map the forbiddenDays array instead of forEach I can see that i'm getting true for every event in the forbiddenDays, which should change the color on theese days, in the calendar.</p>
  
  <p>But right now myFilter method results in this:
  <a href="https://i.stack.imgur.com/V6yRH.png" rel="nofollow noreferrer">pic of calendar</a></p>
  
  <p>What am i doing wrong? I feel like the problem is in myFilter method.</p>
  
  <p><strong>.HTML</strong></p>
  
  <pre><code>    &lt;div class="example-wrapper datePicker"&gt;
          &lt;label class="example-input-wrapper" id="eventInputSuccess"&gt;
              &lt;input (click)="filterForbiddenDays()" id="eventInputError" placeholder="Click to choose date"
                  (dateTimeInput)="basic.openModal()" [(ngModel)]="dateTimeInput" [owlDateTimeTrigger]="dt"
                  [owlDateTimeFilter]="myFilter" [owlDateTime]="dt"&gt;&lt;i class="fa fa-calendar" aria-hidden="true"&gt;&lt;/i&gt;
              &lt;owl-date-time #dt [pickerMode]="'dialog'"&gt;&lt;/owl-date-time&gt;
          &lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance!</p>
  
  <p><strong>EDIT:</strong> </p>
  
  <pre><code>return this.forbiddenDays[0].start.getDate() !== d.getDate();
  </code></pre>
  
  <p>results in : <a href="https://i.stack.imgur.com/TBOtT.png" rel="nofollow noreferrer">expected result but for all days in my array</a></p>
  
  <p>So basically it works great when I specify the index like [0] or [3] etc, but im not sure why it's not working with forEach() or filter()</p>