Browse Source

refactoring

pull/22619/head
erdemcaygor 1 year ago
parent
commit
1b4f4fe0ea
  1. 6
      npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts
  2. 4
      npm/ng-packs/packages/core/src/lib/pipes/utc-to-local.pipe.ts

6
npm/ng-packs/packages/components/extensible/src/lib/components/extensible-table/extensible-table.component.ts

@ -31,6 +31,7 @@ import {
LocalizationModule, LocalizationModule,
PermissionDirective, PermissionDirective,
PermissionService, PermissionService,
UtcToLocalPipe,
} from '@abp/ng.core'; } from '@abp/ng.core';
import { import {
AbpVisibleDirective, AbpVisibleDirective,
@ -64,6 +65,7 @@ const DEFAULT_ACTIONS_COLUMN_WIDTH = 150;
NgxDatatableListDirective, NgxDatatableListDirective,
PermissionDirective, PermissionDirective,
LocalizationModule, LocalizationModule,
UtcToLocalPipe,
AsyncPipe, AsyncPipe,
NgTemplateOutlet, NgTemplateOutlet,
NgComponentOutlet, NgComponentOutlet,
@ -235,4 +237,8 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn
this.cdr.markForCheck(); this.cdr.markForCheck();
}); });
} }
isDateType(prop: EntityProp<R>) {
return prop.type === ePropType.Date || prop.type === ePropType.DateTime;
}
} }

4
npm/ng-packs/packages/core/src/lib/pipes/utc-to-local.pipe.ts

@ -11,8 +11,10 @@ export class UtcToLocalPipe implements PipeTransform {
transform( transform(
value: string | Date | null | undefined, value: string | Date | null | undefined,
apply: boolean,
options?: Intl.DateTimeFormatOptions, options?: Intl.DateTimeFormatOptions,
): string | Date { ): string | Date {
if (!apply) return value;
if (!value) return ''; if (!value) return '';
try { try {
@ -30,7 +32,7 @@ export class UtcToLocalPipe implements PipeTransform {
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
}; };
console.log(this.timezoneService.getTimezone());
const formatter = new Intl.DateTimeFormat('en-US', { const formatter = new Intl.DateTimeFormat('en-US', {
...formatOptions, ...formatOptions,
timeZone: this.timezoneService.getTimezone(), timeZone: this.timezoneService.getTimezone(),

Loading…
Cancel
Save