【发布时间】:2020-03-19 22:30:20
【问题描述】:
看起来很疯狂,但如果日期字段大于当前日期,我无法在 jhipster 测试创建的 html 中进行比较。
我尝试显示从 DB 读取的日期并查看 2020-12-12 然后我尝试显示当前日期。在网上搜索我发现可以得到当前日期:new Date()。所以我尝试显示这个但运行页面时显示错误:
ERROR Error: Uncaught (in promise): Error: Template parse errors:
Parser Error: Unexpected token 'Date' at column 5 in [ {{new Date()}} ] in...
如何获取当前日期(用于检查从 db 读取的日期)?
这里是我需要检查日期的 myclass.component.html 的代码:
<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>
...
【问题讨论】:
-
你能再分享一些代码,让我们看看发生了什么吗?
-
舒尔。我省略了 jhipster 结构,它是标准的 jhipster 结构。所以我有 myclass.component.html myclass.component.ts 等等。
-
在 ts 文件中放什么?
标签: angular typescript jhipster