This commit is contained in:
Zakary Timson 2019-01-02 00:33:48 -05:00
parent 7ea9b4ed57
commit 0046270ebb
2 changed files with 1 additions and 9 deletions

View File

@ -5,7 +5,7 @@
<h1 class="mb-0">{{formatDate(now | async)}}</h1> <h1 class="mb-0">{{formatDate(now | async)}}</h1>
</div> </div>
<div class="pl-2"> <div class="pl-2">
<h1 class="mb-0">{{formatTime(now | async)}}</h1> <h1 class="mb-0">{{now | async | date: 'shortTime'}}</h1>
</div> </div>
</div> </div>
<mat-card class="mt-3 w-100 hover" routerLink="/battery"> <mat-card class="mt-3 w-100 hover" routerLink="/battery">

View File

@ -11,14 +11,6 @@ export class DashboardComponent {
constructor() { } constructor() { }
formatTime(date: Date) {
if(!date) return '';
let hours = date.getHours();
let minutes = date.getMinutes();
if(hours > 12) hours -= 12;
return `${hours < 10 ? `0${hours}` : hours}:${minutes < 10 ? `0${minutes}` : minutes}`
}
formatDate(date: Date) { formatDate(date: Date) {
if(!date) return ''; if(!date) return '';
return `${date.toDateString().substr(4, 3)} ${date.getDate()}`; return `${date.toDateString().substr(4, 3)} ${date.getDate()}`;