How do I calculate my item quantity by checking dates within 30 days of the current date?
Here are the current codes I need to add to my items within 30 days
<template> <div> <div> <div class="tree"> <table width="100%" border="1"> <tr> <th>row</th> <th>Item</th> <th>Category</th> <th>Date</th> <th>Description</th> </tr> <tr v-for="(user,index) in bookData" v-bind:key="user.listData"> <td>{{ user.index }}</td> <td>{{ user.item_id }}</td> <td>{{ user.category_id }}</td> <td>{{ user.r_date }}</td> <td>{{ user.description }}</td> </tr> </table> **New Item within 30 days :** <div> </div> </div> </div> </div> </template> <script lang="ts"> import { Vue, Watch, Component } from 'vue-property-decorator'; import API from '@/API'; @Component export default class BookTable extends Vue { private bookData: any = []; private tempData: any = []; private metadata: any = JSON.stringify([], undefined, 2) ; private created(): void { this.getBookDetails(); if (this.currentUser) { this.getCategories(); } } @Watch('categories') private getBookDetails(): void { if (this.categories.length > 0) { for (const category of this.categories) { API.Book.getBook(category.id).then((response) => { this.bookData = this.bookData.concat(response ? response : []); this.tempData = this.bookData; }); } } } } </script>
Please help as I'm trying to learn more about Vue and am very new to it and typescript.
You can use a calculated property for this and connect it to a function that calculates the number of days. For example