21 lines
508 B
TypeScript
21 lines
508 B
TypeScript
import { Input, Component } from 'ng-metadata/core';
|
|
|
|
/**
|
|
* A component that displays when an event occurred.
|
|
*/
|
|
@Component({
|
|
selector: 'timeDisplay',
|
|
templateUrl: '/static/js/directives/ui/time-display/time-display.component.html'
|
|
})
|
|
export class TimeDisplayComponent {
|
|
@Input('<') public datetime: any;
|
|
@Input('<') public dateOnly: boolean;
|
|
|
|
private getFormat(dateOnly: boolean): string {
|
|
if (dateOnly) {
|
|
return 'ddd, MMM Do YYYY';
|
|
}
|
|
|
|
return 'ddd, MMM Do YYYY, h:mm A';
|
|
}
|
|
}
|