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?

javascript json angular

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Install Angular - Angular Environment Setup Process

Install Angular in easy step by step process. Firstly Install Node.js & npm, then Install Angular CLI, Create workspace and Deploy your App.

Basics of Angular: Part-1

What is Angular? What it does? How we implement it in a project? So, here are some basics of angular to let you learn more about angular. Angular is a Typesc

How Does JSON Pipework in Angular?

Angular has some in-built pipes along with giving us a way to build custom pipes. One of the in-built pipes is JsonPipe. In this article, I would like to walk you through the implementation of this simple JsonPipe.

Javascript parse json | How To Parse JSON in Javascript

Javascript json.parse() is an inbuilt function that converts text into Javascript object.  We can convert JSON string to object using json.parse() method.

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

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