Search JSON between two dates

Search JSON between two dates

I have a JSON object which needs to be searched if I input a angular form with two dates

I have a JSON object which needs to be searched if I input a angular form with two dates

I tried searching using a single date angular form control.

template code:

<div>
   <div class="card w-75">
      <div class="card-body">
          <h5 class="card-title">Invoice summary</h5>
          <hr>
          <p class="card-text">Total revenue made by this venue: <strong> 
   {{totalRevenue}}</strong></p>
          <p *ngIf="invoicesFiltered === true" class="card-text">Revenue 
made on <strong>{{inputInvoiceDate}}</strong> is <strong> 
{{filteredTotalRevenue}}</strong></p>
      </div>
  </div>

<div> <div style="float:left;"> <label for="queryInvoiceDate">Start Date:</label> <input #queryInvoiceDate (change)="filterInvoice(queryInvoiceDate.valueAsDate)" type="date" class="form-control" style="width:100%"> </div>

  &lt;table class="table table-striped" [mfData]="filteredInvoices" #mf="mfDataTable" [mfRowsOnPage]="10"&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;th&gt;Advertiser Acct Balance&lt;/th&gt;
          &lt;th&gt;Service Fee Amt&lt;/th&gt;
          &lt;th&gt;Target Amt for Venue&lt;/th&gt;
          &lt;th&gt;Venue Acct Balance&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr *ngFor="let invoice of mf.data"&gt;
          &lt;td&gt;{{invoice.acntbalances}}&lt;/td&gt;
          &lt;td&gt;{{invoice.servicefeeamount}}&lt;/td&gt;
          &lt;td&gt;{{invoice.targetamount}}&lt;/td&gt;
          &lt;td&gt;{{invoice.targetbalance}}&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
      &lt;tfoot&gt;
        &lt;tr&gt;
            &lt;td colspan="4"&gt;
                &lt;mfBootstrapPaginator [rowsOnPageSet]="[10,15,20]"&gt;&lt;/mfBootstrapPaginator&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;

</div>

component code:

filterInvoice(queryInvoiceDate: any) {
    this.inputInvoiceDate = queryInvoiceDate.toISOString().split('T')[0];
    this.filteredInvoices = (queryInvoiceDate) ?
    this.invoices.filter(i => 
       i.timestamp.includes(queryInvoiceDate.toISOString().split('T')[0])) : this.invoices;
    console.log(queryInvoiceDate.toISOString());
    this.filteredTotalRevenue = this.filteredInvoices.reduce((sum, invoice) => {
  return sum + invoice.targetamount; }, 0);
}

What would i need to do if I want to pass two dates and search for all JSON values falling between the passed dates and specific timestamps?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

JSON Tutorial For Beginners | What is JSON | Learning JSON with JavaScript

JSON Tutorial For Beginners | What is JSON | Learning JSON with JavaScript

Javascript | How To Covert Javascript Array To JSON

In this example, we will see How To Covert Javascript Array To JSON. We can convert Javascript array to json using JSON.stringify() method. At some point in your time, whatever developer you are, you need to deal with JSON data. JSON stands for Javascript Object Notation. Exchange data between client and server is straightforward using JSON.

JavaScript | Convert JSON String to JSON Object

Convert JSON string to JSON object javascript. This tutorial is the purpose to explain the best ways and examples for convert JSON string to a JSON object.