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,
PermissionDirective,
PermissionService,
UtcToLocalPipe,
} from '@abp/ng.core';
import {
AbpVisibleDirective,
@ -64,6 +65,7 @@ const DEFAULT_ACTIONS_COLUMN_WIDTH = 150;
NgxDatatableListDirective,
PermissionDirective,
LocalizationModule,
UtcToLocalPipe,
AsyncPipe,
NgTemplateOutlet,
NgComponentOutlet,
@ -235,4 +237,8 @@ export class ExtensibleTableComponent<R = any> implements OnChanges, AfterViewIn
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(
value: string | Date | null | undefined,
apply: boolean,
options?: Intl.DateTimeFormatOptions,
): string | Date {
if (!apply) return value;
if (!value) return '';
try {
@ -30,7 +32,7 @@ export class UtcToLocalPipe implements PipeTransform {
hour: '2-digit',
minute: '2-digit',
};
console.log(this.timezoneService.getTimezone());
const formatter = new Intl.DateTimeFormat('en-US', {
...formatOptions,
timeZone: this.timezoneService.getTimezone(),

Loading…
Cancel
Save