16 lines
353 B
TypeScript
16 lines
353 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class DateService {
|
|
private readonly dateTimeFormat = Intl.DateTimeFormat('en-US', {
|
|
dateStyle: 'long',
|
|
timeStyle: 'short',
|
|
});
|
|
|
|
public format(raw: string): string {
|
|
return this.dateTimeFormat.format(new Date(raw));
|
|
}
|
|
}
|