Skip to content

Commit

Permalink
Fix date error in case file view (#1839)
Browse files Browse the repository at this point in the history
* Fix ccdDate pipe format string code to work properly with local time offsets.
Remove call to Angular date pipe which seemingly was only there to handle local date conversion, but which has a bug on the last day of the year
Update tests to test for last day of year

* update version

* version updated

---------

Co-authored-by: RiteshHMCTS <74713687+RiteshHMCTS@users.noreply.github.com>
Co-authored-by: Ritesh Dsouza <ritesh.dsouza@HMCTS.net>
  • Loading branch information
3 people authored Jan 16, 2025
1 parent 1932149 commit 6a2f0d7
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 8 deletions.
3 changes: 3 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## RELEASE NOTES

### Version 7.1.27
**EXUI-2672** Incorrect Timestamp in CaseFileView

### Version 7.1.26
**EXUI-2223** Accessibility-issue

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.26",
"version": "7.1.27",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.1.26",
"version": "7.1.27",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import SpyObj = jasmine.SpyObj;
import createSpyObj = jasmine.createSpyObj;
import { CaseNotifier } from '../../case-editor';
import { AbstractAppConfig } from '../../../../app.config';
import { CaseFileViewFolderSortComponent } from './components';

describe('CaseFileViewFieldComponent', () => {
let component: CaseFileViewFieldComponent;
Expand Down Expand Up @@ -78,7 +79,8 @@ describe('CaseFileViewFieldComponent', () => {
RouterTestingModule
],
declarations: [
CaseFileViewFieldComponent
CaseFileViewFieldComponent,
CaseFileViewFolderSortComponent
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span class="node__name node-name-document">
{{node.name}}
<br>
<span class="node__document-upload-timestamp">{{node.upload_timestamp | ccdDate : 'local' | date:"dd MMM YYYY HH:mm"}}</span>
<span class="node__document-upload-timestamp">{{node.upload_timestamp | ccdDate : 'local' :'dd MMM YYYY HH:mm'}}</span>
</span>
<div class="node__document-options">
<ccd-case-file-view-folder-document-actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('CaseFileViewFolderComponent', () => {
document_filename: 'Lager encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: '2023-05-11T11:15:10.00'
upload_timestamp: '2024-12-31T09:56:00'
},
{
name: 'Beers encyclopedia',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const categoriesAndDocumentsTestData: CategoriesAndDocuments = {
document_filename: 'Lager encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: '2023-05-11T11:15:10.00',
upload_timestamp: '2024-12-31T09:56:00',
content_type: ''
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const lagerEncyclopedia = {
document_filename: 'Lager encyclopedia',
document_binary_url: '/test/binary',
attribute_path: '',
upload_timestamp: '2023-05-11T11:15:10.00'
upload_timestamp: '2024-12-31T09:56:00'
};

export const beersEncyclopedia = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component } from '@angular/core';

@Component({
selector: 'ccd-unsupported-field',
template: `<em>Field type not supported</em>`
})
export class UnsupportedFieldComponent {}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class DatePipe implements PipeTransform {
if (this.formatTrans && format && format !== 'short') {
// support for java style formatting strings for dates
format = this.translateDateFormat(format);
resultDate = moment(date).format(format);
resultDate = moment(offsetDate).format(format);
} else {
// RDM-1149 changed the pipe logic so that it doesn't add an hour to 'Summer Time' dates on DateTime field type
resultDate = `${offsetDate.getDate()} ${DatePipe.MONTHS[offsetDate.getMonth()]} ${offsetDate.getFullYear()}`;
Expand Down

0 comments on commit 6a2f0d7

Please sign in to comment.