Filtering Angular 6 elements by their start and finish dates

HTML

   <div>
     <nav class="navbar">
       <a class="navbar-brand">Checkout-Reports</a>
     </nav>

     <div>
       <label>From </label>
       <input type="date" class="mx-3" />
       <label>To </label>
       <input class="mx-3" type="date" />
     </div>
   </div>

   <div id="table-scroll" class="table-scroll table-bordered">
     <div class="table-wrap" id="checkouts">
       <table class="main-table">
         <thead>
           <tr>
             <th class="fixed-side" scope="col">Name</th>
             <th scope="col">M-No</th>
             <th scope="col">Check-in Date</th>
             <th scope="col">Sharing Type</th>
             <th scope="col">Bed</th>
             <th scope="col">Advance</th>
             <th scope="col">Monthly Rent</th>
             <th scope="col">Checkouted Date</th>
           </tr>
         </thead>

         <tbody>
           <tr *ngFor="let checkout of pgCheckOutList">
             <th class="fixed-side">
               {{ checkout.firstName }} {{ checkout.lastName }}
             </th>
             <td>{{ checkout.mNumber }}</td>
             <td>{{ checkout.checkOutDate | date: "dd-MM-yyyy" }}</td>
             <td>4</td>
             <td>420</td>
             <td>{{ checkout.balAmt }}</td>
             <td>5000</td>
             <td>{{ checkout.roomNo }}</td>
           </tr>
         </tbody>
       </table>
     </div>
   </div>

TS!!

   @Component({
     selector: "app-checkout-list-report",
     templateUrl: "./checkout-list-report.component.html",
     styleUrls: ["./checkout-list-report.component.scss"]
   })
   export class CheckoutListReportComponent implements OnInit {
     pgCheckOutList: CheckOut[] = [];



     constructor(
       private tenantService: TenantService,
       private activatedRoute: ActivatedRoute,
       private router: Router,
       private checkOutService: CheckOutService
     ) {}

     ngOnInit() {
       this.checkOutService
         .getCheckOuts()
         .subscribe((checkouts: CheckOut[]) => {
           this.pgCheckOutList = checkouts;
         });
     }

CSS

.table-scroll {
  position: relative;
  margin: auto;
  overflow: hidden;
}
.table-wrap {
  width: 100%;
  overflow: auto;
}
.table-scroll table {
  width: 100%;
  margin: auto;
  border-collapse: separate;
  border-spacing: 0;
}
.table-scroll th,
.table-scroll td {
  padding: 5px 10px;
  white-space: nowrap;
  vertical-align: top;
}

I need to filter the items by a specified start and end date range.

I am working on implementing a filtering functionality for a data array that corresponds to a list of checkouts based on the user's input start and end dates in TypeScript for my Angular application.

I need to filter the items by a specified start and end date range. I am currently developing a feature to filter a data array of checkouts based on the user's provided from-date and to-date inputs in TypeScript for my Angular Application.

I need to filter the items by a specific start date and end date range. Working on filtering a data array of checkout lists based on user input start and end dates in TypeScript for my Angular application.

Answer №1

Looking for a way to filter your fields? Check out the ngx-filter-pipe npm package, which allows you to specify any fields you want to filter.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the method for modifying the background color of an HTML page specifically for printing purposes?

My goal is to enhance the printability of my website. The background color of the HTML document's body is not white. body { background-color: #F8F6F6; } The issue lies in the fact that certain sections of the printed page, such as the margins and ...

Is it possible to adjust the height of a panel in Jquery Mobile 1.4.5?

Currently working on a jqm project that is specifically for mobile devices. In this project, I have implemented two panels - one set to push and the other overlay. While one panel is positioned in the left corner of the screen, the other is located in the ...

Angular directive button failing to trigger ng-click event

Recently, I started working with Angular and ran into an issue while trying to set up a custom directive. The purpose of this directive is to display a button upon hovering over it, which, when clicked, should trigger a function within the directive. The b ...

Click on an element in Angular to toggle it

A function in my codebase is responsible for toggling a specific section within a div element. Currently, there are a total of 3 sections available in the app. The functionality is implemented in the app.component.ts file: show = false; toggle() { ...

Dealing with problematic hover behaviors in Cypress: A guide

I encountered an issue with Cypress hover functionality while trying to access a sub menu that appears after hovering over a main menu item. The error message I received was This element is not visible because it has CSS property: position: fixed and it&ap ...

What is the best way to retrieve the value of a div using AutoIt?

For this particular scenario, my objective is to extract a specific value from the last div element in the following list: <div id="past"> <div class="ball ball-8" data-rollid="242539">11</div> <div class="ball ball-8" data-ro ...

Instructions for adding a unique custom external CSS link, such as Bootstrap CSS, to a specific REACT component

Is it possible to incorporate custom CSS from the Bootstrap website into a React component? Since this CSS file cannot be imported directly, what steps should I take to include it? <link href="https://getbootstrap.com/docs/4.5/dist/css/bootstrap. ...

What is the comparable alternative to promise<void> in observables?

I've been working with Angular using TypeScript and I'm attempting to return a promise from an observable. What is the correct way to accomplish this? So far, I have tried the following: of(EMPTY).toPromise() // error: Promise<Observable<n ...

Pausing for an asynchronous operation to complete prior to submitting a form

This particular issue presents a challenge. Below is my jQuery code snippet: /** * Updating websites */ $('.website').on('blur', function () { var websiteId = this.id; console.log(websiteId); var website = this.value; ...

Javascript code for creating a dropdown menu with clickable options

I have implemented a JavaScript function that creates three clickable drop-down menu buttons on my webpage. When I click on one button, the script works correctly and displays the corresponding menu. However, when I click on another button, the new menu is ...

Implement a style to all elements except for the special element

Learn HTML <ul id="tree"> <li> <label> <input type="checkbox" /> Level 1 - 1</label> </li> <li> <label> <input type="checkbox" /> Level 1 - 2</lab ...

Issue with accessing hamburger menu on Bootstrap site

I recently added a navigation bar to my website using the BootStrap documentation. However, when I switch to the mobile version and click on the hamburger menu, nothing happens. Below is the code snippet for reference: <nav class="navbar navbar-expand- ...

Tips for adjusting the angle in SVG shapes

I have designed an svg shape, but I'm struggling to get the slope to start from the middle. Can someone please provide assistance? <svg xmlns="http://www.w3.org/2000/svg" fill="none"> <g filter="url(#filter0_b_1_2556)"&g ...

Retrieve the HTML tag content as a string using jQuery

For my OSINT project, I am developing a tool that needs to extract text from a specific HTML code string. $("p").text(); I'm looking for a way to make my variable work with the above code. Any suggestions? Share your ideas! Solution: $.ajax({ ...

Issue: Unable to locate 'child_process' in Angular 5

I am a newcomer to Angular, and I have encountered a requirement in my project to retrieve the MAC address of the user's system. To achieve this, I performed an NPM installation as shown below: npm install --save macaddress Next, I added the follow ...

The deletion of columns is malfunctioning when using jQuery

When I click on number 2, it deletes the second column, which is working correctly. However, when I click on number 3, it deletes the number 3 instead of its column. The code snippet causing this issue is shown below: Can someone assist me in identifying ...

Creating a secondary menu below the navbar using Bootstrap 3's nav-pills component

Is it possible to create a secondary menu using Bootstrap 3 with nav-pills that behaves like a secondary navbar? Check out this video tutorial Here is the HTML code for my menu: <div class="row"> <div class="col-md-12"> <ul class="n ...

Comparing Necessary and Deduced Generic Types in TypeScript

Can you explain the difference between these two generic types? type FnWithRequiredParam<T> = (t: T) => void type FnWithParamInferred = <T>(t: T) => void From what I understand, FnWithRequiredParam will always require the generic type t ...

Error: zsh is unable to locate the command, even after defining it in package.json bin and installing it globally

I attempted to create a command-line application using TypeScript. Below is the code I have written: //package.json { "name": "jihea-cli", "version": "1.0.0", "description": "", "main": "index.ts", "bin": { "cli": "./bin/index.ts" }, // ...

Bootstrap 5 does not currently support the use of maxlength and minlength attributes

I've been attempting to set a maxlength and minlength for an input in Bootstrap 5, but it doesn't seem to be working. Can you help me troubleshoot this issue? Here's the code: <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-c ...