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

View File

@ -11,14 +11,6 @@ export class DashboardComponent {
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) {
if(!date) return '';
return `${date.toDateString().substr(4, 3)} ${date.getDate()}`;