mirror of https://github.com/abpframework/abp.git
5 changed files with 109 additions and 0 deletions
@ -1,3 +1,6 @@ |
|||
export * from './localization.pipe'; |
|||
export * from './sort.pipe'; |
|||
export * from './to-injector.pipe'; |
|||
export * from './short-date.pipe'; |
|||
export * from './short-time.pipe'; |
|||
export * from './short-date-time.pipe'; |
|||
|
|||
@ -0,0 +1,32 @@ |
|||
import { DatePipe, DATE_PIPE_DEFAULT_TIMEZONE } from '@angular/common'; |
|||
import { Inject, LOCALE_ID, Optional, Pipe, PipeTransform } from '@angular/core'; |
|||
import { ConfigStateService } from '../services'; |
|||
import { getShortDateShortTimeFormat } from '../utils/date-utils'; |
|||
|
|||
@Pipe({ |
|||
name: 'shortDateTime', |
|||
pure: true, |
|||
}) |
|||
export class ShortDateTimePipe extends DatePipe implements PipeTransform { |
|||
|
|||
constructor(private configStateService: ConfigStateService, |
|||
@Inject(LOCALE_ID) locale: string, |
|||
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null |
|||
) { |
|||
super(locale, defaultTimezone) |
|||
} |
|||
|
|||
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null; |
|||
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null; |
|||
transform( |
|||
value: string|number|Date|null|undefined, timezone?: string, |
|||
locale?: string): string|null { |
|||
|
|||
const format = getShortDateShortTimeFormat(this.configStateService); |
|||
return super.transform(value,format,timezone,locale) |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,32 @@ |
|||
import { DatePipe, DATE_PIPE_DEFAULT_TIMEZONE } from '@angular/common'; |
|||
import { Inject, LOCALE_ID, Optional, Pipe, PipeTransform } from '@angular/core'; |
|||
import { ConfigStateService } from '../services'; |
|||
import { getShortDateFormat } from '../utils/date-utils'; |
|||
|
|||
@Pipe({ |
|||
name: 'shortDate', |
|||
pure: true, |
|||
}) |
|||
export class ShortDatePipe extends DatePipe implements PipeTransform { |
|||
|
|||
constructor(private configStateService: ConfigStateService, |
|||
@Inject(LOCALE_ID) locale: string, |
|||
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null |
|||
) { |
|||
super(locale, defaultTimezone) |
|||
} |
|||
|
|||
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null; |
|||
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null; |
|||
transform( |
|||
value: string|number|Date|null|undefined, timezone?: string, |
|||
locale?: string): string|null { |
|||
|
|||
const format = getShortDateFormat(this.configStateService); |
|||
return super.transform(value,format,timezone,locale) |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,32 @@ |
|||
import { DatePipe, DATE_PIPE_DEFAULT_TIMEZONE } from '@angular/common'; |
|||
import { Inject, LOCALE_ID, Optional, Pipe, PipeTransform } from '@angular/core'; |
|||
import { ConfigStateService } from '../services'; |
|||
import { getShortTimeFormat } from '../utils/date-utils'; |
|||
|
|||
@Pipe({ |
|||
name: 'shortTime', |
|||
pure: true, |
|||
}) |
|||
export class ShortTimePipe extends DatePipe implements PipeTransform { |
|||
|
|||
constructor(private configStateService: ConfigStateService, |
|||
@Inject(LOCALE_ID) locale: string, |
|||
@Inject(DATE_PIPE_DEFAULT_TIMEZONE) @Optional() defaultTimezone?: string|null |
|||
) { |
|||
super(locale, defaultTimezone) |
|||
} |
|||
|
|||
transform(value: Date | string | number, format?: string, timezone?: string, locale?: string): string | null; |
|||
transform(value: null | undefined, format?: string, timezone?: string, locale?: string): null; |
|||
transform( |
|||
value: string|number|Date|null|undefined, timezone?: string, |
|||
locale?: string): string|null { |
|||
|
|||
const format = getShortTimeFormat(this.configStateService); |
|||
return super.transform(value,format,timezone,locale) |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
Loading…
Reference in new issue