It may sound strange, but I'm having trouble figuring out how to compare a date field in an HTML created by JHipster test if it's greater than the current date.
I attempted to display the date fetched from the database as 2020-12-12 and then tried to show the current date. After searching online, I found that it's possible to obtain the current date using: new Date()
. However, when I try to display this on the page, I encounter an error:
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Parser Error: Unexpected token 'Date' at column 5 in [ {{new Date()}} ] in...
How do I retrieve the current date for comparison with the one retrieved from the database?
Below is the code from myclass.component.html where I need to validate the date:
<div>
<jhi-alert-error></jhi-alert-error>
...
<div class="table-responsive" *ngIf="myclasses?.length > 0">
<table class="table table-striped" aria-describedby="page-heading">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="reverse" [callback]="transition.bind(this)">
<th...
</tr>
</thead>
<tbody>
<tr *ngFor="let myclasse of myclasses ;trackBy: trackId">
<td>{{myclass?.id}}</td>
...
<td>
{{ new Date() }}
</td>
...