Skip to content

Commit

Permalink
add relative date (#24476)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoreras authored Mar 24, 2023
1 parent 505abeb commit cfa959a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
{{ experiment.name }}
</td>
<td data-testId="experiment-row__createdDate">
{{ experiment.creationDate | date : 'longDate' }}
{{ experiment.creationDate | dotRelativeDate : true }}
</td>
<td data-testId="experiment-row__modDate">
{{ experiment.modDate | date : 'longDate' }}
{{ experiment.modDate | dotRelativeDate : true }}
</td>
<td data-testId="experiment-row__actions">
<ng-container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import { UiDotIconButtonTooltipModule } from '@components/_common/dot-icon-butto
import { DotMessageService } from '@dotcms/data-access';
import { DotExperimentStatusList, GroupedExperimentByStatus } from '@dotcms/dotcms-models';
import { DotIconModule } from '@dotcms/ui';
import { MockDotMessageService } from '@dotcms/utils-testing';
import { DotFormatDateServiceMock, MockDotMessageService } from '@dotcms/utils-testing';
import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module';
import { DotRelativeDatePipe } from '@pipes/dot-relative-date/dot-relative-date.pipe';
import { getExperimentMock } from '@portlets/dot-experiments/test/mocks';
import { DotFormatDateService } from '@services/dot-format-date-service';

import { DotExperimentsListTableComponent } from './dot-experiments-list-table.component';

Expand Down Expand Up @@ -68,7 +70,8 @@ describe('DotExperimentsListTableComponent', () => {
ConfirmPopupModule,
ToastModule,
DotMessagePipeModule,
RouterTestingModule
RouterTestingModule,
DotRelativeDatePipe
],
component: DotExperimentsListTableComponent,
componentMocks: [ConfirmPopup],
Expand All @@ -79,7 +82,8 @@ describe('DotExperimentsListTableComponent', () => {
useValue: messageServiceMock
},
MessageService,
ConfirmationService
ConfirmationService,
{ provide: DotFormatDateService, useClass: DotFormatDateServiceMock }
]
});

Expand Down Expand Up @@ -127,11 +131,9 @@ describe('DotExperimentsListTableComponent', () => {
groupedExperimentByStatus.DRAFT[0].name
);
expect(spectator.query(byTestId('experiment-row__createdDate'))).toHaveText(
groupedExperimentByStatus.DRAFT[0].creationDate.toLocaleDateString()
);
expect(spectator.query(byTestId('experiment-row__modDate'))).toHaveText(
groupedExperimentByStatus.DRAFT[0].modDate.toLocaleDateString()
'1 hour ago'
);
expect(spectator.query(byTestId('experiment-row__modDate'))).toHaveText('1 hour ago');
});

describe('Actions icons', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { UiDotIconButtonModule } from '@components/_common/dot-icon-button/dot-i
import { UiDotIconButtonTooltipModule } from '@components/_common/dot-icon-button-tooltip/dot-icon-button-tooltip.module';
import { DotIconModule } from '@dotcms/ui';
import { DotMessagePipeModule } from '@pipes/dot-message/dot-message-pipe.module';
import { DotRelativeDatePipe } from '@pipes/dot-relative-date/dot-relative-date.pipe';
import { DotExperimentsListRoutingModule } from '@portlets/dot-experiments/dot-experiments-list/dot-experiments-list-routing.module';
import { DotExperimentsService } from '@portlets/dot-experiments/shared/services/dot-experiments.service';
import { DotExperimentsUiHeaderComponent } from '@portlets/dot-experiments/shared/ui/dot-experiments-header/dot-experiments-ui-header.component';
Expand Down Expand Up @@ -58,7 +59,8 @@ import { DotExperimentsListComponent } from './dot-experiments-list.component';
MenuModule,
ConfirmDialogModule,
ConfirmPopupModule,
ToastModule
ToastModule,
DotRelativeDatePipe
],
providers: [DotExperimentsService]
})
Expand Down

0 comments on commit cfa959a

Please sign in to comment.