Add support for date-only to the time-display component
This commit is contained in:
parent
89d635f6cf
commit
b5b4aa154c
3 changed files with 11 additions and 2 deletions
|
@ -26,7 +26,7 @@
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td class="history-row" ng-if="entry.date_break" colspan="2">
|
<td class="history-row" ng-if="entry.date_break" colspan="2">
|
||||||
{{ entry.date | amDateFormat:'dddd, MMMM Do YYYY' }}
|
<time-display datetime="entry.date" date-only="true"></time-display>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td ng-if="!entry.date_break" class="icon-col">
|
<td ng-if="!entry.date_break" class="icon-col">
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<span>{{ ::$ctrl.datetime | amDateFormat:'dddd, MMMM Do YYYY, h:mm A' }}</span>
|
<span>{{ ::$ctrl.datetime | amDateFormat:$ctrl.getFormat($ctrl.dateOnly) }}</span>
|
|
@ -9,4 +9,13 @@ import { Input, Component } from 'ng-metadata/core';
|
||||||
})
|
})
|
||||||
export class TimeDisplayComponent {
|
export class TimeDisplayComponent {
|
||||||
@Input('<') public datetime: any;
|
@Input('<') public datetime: any;
|
||||||
|
@Input('<') public dateOnly: boolean;
|
||||||
|
|
||||||
|
private getFormat(dateOnly: boolean): string {
|
||||||
|
if (dateOnly) {
|
||||||
|
return 'dddd, MMMM Do YYYY';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'dddd, MMMM Do YYYY, h:mm A';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue