geonetwork-ui 2.4.2 → 2.5.0-dev.77e75b46a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.mjs +11 -11
- package/esm2022/libs/ui/elements/src/lib/metadata-info/metadata-info.component.mjs +18 -10
- package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +14 -12
- package/esm2022/libs/util/shared/src/lib/services/date.service.mjs +41 -0
- package/esm2022/libs/util/shared/src/lib/services/index.mjs +2 -1
- package/esm2022/libs/util/shared/src/lib/utils/temporal-extent-union.mjs +4 -4
- package/fesm2022/geonetwork-ui.mjs +318 -274
- package/fesm2022/geonetwork-ui.mjs.map +1 -1
- package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts +3 -3
- package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts.map +1 -1
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts +5 -0
- package/libs/ui/elements/src/lib/metadata-info/metadata-info.component.d.ts.map +1 -1
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -2
- package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
- package/libs/util/shared/src/lib/services/date.service.d.ts +13 -0
- package/libs/util/shared/src/lib/services/date.service.d.ts.map +1 -0
- package/libs/util/shared/src/lib/services/index.d.ts +1 -0
- package/libs/util/shared/src/lib/services/index.d.ts.map +1 -1
- package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts +2 -1
- package/libs/util/shared/src/lib/utils/temporal-extent-union.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts +3 -4
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.html +3 -3
- package/src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +12 -2
- package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +4 -2
- package/src/libs/util/shared/src/lib/services/date.service.ts +45 -0
- package/src/libs/util/shared/src/lib/services/index.ts +1 -0
- package/src/libs/util/shared/src/lib/utils/temporal-extent-union.ts +6 -3
package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { WizardService } from '../../services/wizard.service';
|
|
2
|
-
import {
|
|
2
|
+
import { DateService } from '../../../../../../../libs/util/shared/src';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class WizardSummarizeComponent {
|
|
5
5
|
private wizardService;
|
|
6
|
-
private
|
|
6
|
+
private dateService;
|
|
7
7
|
get title(): any;
|
|
8
8
|
get abstract(): any;
|
|
9
9
|
get tags(): string;
|
|
10
10
|
get createdDate(): string;
|
|
11
11
|
get scale(): string;
|
|
12
12
|
get description(): any;
|
|
13
|
-
constructor(wizardService: WizardService,
|
|
13
|
+
constructor(wizardService: WizardService, dateService: DateService);
|
|
14
14
|
static ɵfac: i0.ɵɵFactoryDeclaration<WizardSummarizeComponent, never>;
|
|
15
15
|
static ɵcmp: i0.ɵɵComponentDeclaration<WizardSummarizeComponent, "gn-ui-wizard-summarize", never, {}, {}, never, never, false, never>;
|
|
16
16
|
}
|
package/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard-summarize.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"wizard-summarize.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAA;;AAEvE,qBAKa,wBAAwB;IA6CjC,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,WAAW;IA7CrB,IAAI,KAAK,QAER;IAED,IAAI,QAAQ,QAEX;IAED,IAAI,IAAI,IAAI,MAAM,CAQjB;IAED,IAAI,WAAW,WAQd;IAED,IAAI,KAAK,WASR;IAED,IAAI,WAAW,QAEd;gBAGS,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW;yCA9CvB,wBAAwB;2CAAxB,wBAAwB;CAgDpC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { EventEmitter } from '@angular/core';
|
|
2
2
|
import { DatasetRecord, Keyword } from '../../../../../../libs/common/domain/src/lib/model/record';
|
|
3
|
+
import { DateService } from '../../../../../../libs/util/shared/src';
|
|
3
4
|
import * as i0 from "@angular/core";
|
|
4
5
|
export declare class MetadataInfoComponent {
|
|
6
|
+
private dateService;
|
|
5
7
|
metadata: Partial<DatasetRecord>;
|
|
6
8
|
incomplete: boolean;
|
|
7
9
|
keyword: EventEmitter<Keyword>;
|
|
8
10
|
updatedTimes: number;
|
|
11
|
+
constructor(dateService: DateService);
|
|
9
12
|
get hasUsage(): boolean;
|
|
10
13
|
get legalConstraints(): any[];
|
|
11
14
|
get otherConstraints(): any[];
|
|
@@ -22,6 +25,8 @@ export declare class MetadataInfoComponent {
|
|
|
22
25
|
get resourceContact(): import("../../../../../common/domain/src/lib/model/record/contact.model").Individual;
|
|
23
26
|
fieldReady(propName: string): boolean;
|
|
24
27
|
onKeywordClick(keyword: Keyword): void;
|
|
28
|
+
formatDate(date: Date): string;
|
|
29
|
+
formatDateTime(date: Date): string;
|
|
25
30
|
static ɵfac: i0.ɵɵFactoryDeclaration<MetadataInfoComponent, never>;
|
|
26
31
|
static ɵcmp: i0.ɵɵComponentDeclaration<MetadataInfoComponent, "gn-ui-metadata-info", never, { "metadata": { "alias": "metadata"; "required": false; }; "incomplete": { "alias": "incomplete"; "required": false; }; }, { "keyword": "keyword"; }, never, never, true, never>;
|
|
27
32
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-info.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAGb,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,OAAO,EACR,MAAM,2DAA2D,CAAA;;
|
|
1
|
+
{"version":3,"file":"metadata-info.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAGb,MAAM,eAAe,CAAA;AACtB,OAAO,EACL,aAAa,EACb,OAAO,EACR,MAAM,2DAA2D,CAAA;AAClE,OAAO,EAAE,WAAW,EAAyB,MAAM,wCAAwC,CAAA;;AAmB3F,qBA0Ba,qBAAqB;IAMpB,OAAO,CAAC,WAAW;IALtB,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAChC,UAAU,EAAE,OAAO,CAAA;IAClB,OAAO,wBAA8B;IAC/C,YAAY,EAAE,MAAM,CAAA;gBAEA,WAAW,EAAE,WAAW;IAE5C,IAAI,QAAQ,YASX;IAED,IAAI,gBAAgB,UAanB;IAED,IAAI,gBAAgB,UAQnB;IAED,IAAI,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAU9C;IAED,IAAI,eAAe,IAAI,MAAM,CAS5B;IAED,IAAI,cAAc,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAGnD;IAED,IAAI,iBAAiB,gGAEpB;IAED,IAAI,eAAe,yFAElB;IAED,UAAU,CAAC,QAAQ,EAAE,MAAM;IAI3B,cAAc,CAAC,OAAO,EAAE,OAAO;IAI/B,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAI9B,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;yCA5FvB,qBAAqB;2CAArB,qBAAqB;CA+FjC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ChangeDetectorRef, ElementRef, EventEmitter, QueryList, ViewContainerRef } from '@angular/core';
|
|
2
2
|
import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record';
|
|
3
3
|
import { SortByField } from '../../../../../../libs/common/domain/src/lib/model/search';
|
|
4
|
-
import { FileFormat } from '../../../../../../libs/util/shared/src';
|
|
4
|
+
import { DateService, FileFormat } from '../../../../../../libs/util/shared/src';
|
|
5
5
|
import { Overlay } from '@angular/cdk/overlay';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
7
|
export declare class ResultsTableComponent {
|
|
8
8
|
private overlay;
|
|
9
9
|
private viewContainerRef;
|
|
10
10
|
private cdr;
|
|
11
|
+
private dateService;
|
|
11
12
|
records: CatalogRecord[];
|
|
12
13
|
selectedRecordsIdentifiers: string[];
|
|
13
14
|
sortOrder: SortByField;
|
|
@@ -24,7 +25,7 @@ export declare class ResultsTableComponent {
|
|
|
24
25
|
actionMenuButtons: QueryList<ElementRef>;
|
|
25
26
|
private overlayRef;
|
|
26
27
|
isActionMenuOpen: boolean;
|
|
27
|
-
constructor(overlay: Overlay, viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef);
|
|
28
|
+
constructor(overlay: Overlay, viewContainerRef: ViewContainerRef, cdr: ChangeDetectorRef, dateService: DateService);
|
|
28
29
|
openActionMenu(item: any, template: any): void;
|
|
29
30
|
closeActionMenu(): void;
|
|
30
31
|
dateToString(date: Date): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results-table.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/search/src/lib/results-table/results-table.component.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAEjB,UAAU,EACV,YAAY,EAGZ,SAAS,EAET,gBAAgB,EACjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,2DAA2D,CAAA;AACzF,OAAO,EAEL,WAAW,EACZ,MAAM,2DAA2D,CAAA;AAMlE,OAAO,EACL,UAAU,EAKX,MAAM,wCAAwC,CAAA;AAK/C,OAAO,EAGL,OAAO,EAER,MAAM,sBAAsB,CAAA;;AAI7B,qBAkBa,qBAAqB;IA0B9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"results-table.component.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/ui/search/src/lib/results-table/results-table.component.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EAEjB,UAAU,EACV,YAAY,EAGZ,SAAS,EAET,gBAAgB,EACjB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,aAAa,EAAE,MAAM,2DAA2D,CAAA;AACzF,OAAO,EAEL,WAAW,EACZ,MAAM,2DAA2D,CAAA;AAMlE,OAAO,EACL,WAAW,EACX,UAAU,EAKX,MAAM,wCAAwC,CAAA;AAK/C,OAAO,EAGL,OAAO,EAER,MAAM,sBAAsB,CAAA;;AAI7B,qBAkBa,qBAAqB;IA0B9B,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,gBAAgB;IACxB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,WAAW;IA5BZ,OAAO,EAAE,aAAa,EAAE,CAAK;IAC7B,0BAA0B,EAAE,MAAM,EAAE,CAAK;IACzC,SAAS,EAAE,WAAW,CAAO;IAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAc;IAC1D,YAAY,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAa;IAC7D,SAAS,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAa;IAC1D,WAAW,UAAQ;IACnB,aAAa,UAAQ;IAGpB,YAAY,yCAA+C;IAC3D,WAAW,8BAAoC;IAC/C,eAAe,8BAAoC;IACnD,YAAY,8BAAoC;IAChD,qBAAqB,2CAE5B;IAGH,iBAAiB,EAAG,SAAS,CAAC,UAAU,CAAC,CAAA;IACzC,OAAO,CAAC,UAAU,CAAa;IAE/B,gBAAgB,UAAQ;gBAGd,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,GAAG,EAAE,iBAAiB,EACtB,WAAW,EAAE,WAAW;IAGlC,cAAc,CAAC,IAAI,KAAA,EAAE,QAAQ,KAAA;IAyC7B,eAAe;IAQf,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAShC,gBAAgB,CAAC,MAAM,EAAE,aAAa,GAAG,UAAU,EAAE;IAerD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM;IAIlD,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAIzC,iBAAiB,CAAC,IAAI,EAAE,aAAa;IAKrC,eAAe,CAAC,IAAI,EAAE,OAAO;IAI7B,YAAY,CAAC,IAAI,EAAE,OAAO;IAK1B,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM;IAI5C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,IAAI;IAe9C,SAAS,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAIzC,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa;yCAtJxD,qBAAqB;2CAArB,qBAAqB;CAyJjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class DateService {
|
|
4
|
+
private translateService;
|
|
5
|
+
constructor(translateService: TranslateService);
|
|
6
|
+
private getDateObject;
|
|
7
|
+
private getLocaleAndDate;
|
|
8
|
+
formatDate(date: Date | string, options?: Intl.DateTimeFormatOptions): string;
|
|
9
|
+
formatDateTime(date: Date | string, options?: Intl.DateTimeFormatOptions): string;
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateService, never>;
|
|
11
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<DateService>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=date.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.service.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/services/date.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;;AAEtD,qBAGa,WAAW;IACV,OAAO,CAAC,gBAAgB;gBAAhB,gBAAgB,EAAE,gBAAgB;IAEtD,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,gBAAgB;IASxB,UAAU,CACR,IAAI,EAAE,IAAI,GAAG,MAAM,EACnB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GACnC,MAAM;IAKT,cAAc,CACZ,IAAI,EAAE,IAAI,GAAG,MAAM,EACnB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GACnC,MAAM;yCAlCE,WAAW;6CAAX,WAAW;CAsCvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"temporal-extent-union.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/utils/temporal-extent-union.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CACnC,MAAM,EAAE;IACN,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,EAAE;;;
|
|
1
|
+
{"version":3,"file":"temporal-extent-union.d.ts","sourceRoot":"","sources":["../../../../../../src/libs/util/shared/src/lib/utils/temporal-extent-union.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,wBAAgB,qBAAqB,CACnC,MAAM,EAAE;IACN,KAAK,CAAC,EAAE,IAAI,CAAA;IACZ,GAAG,CAAC,EAAE,IAAI,CAAA;CACX,EAAE,EACH,WAAW,EAAE,WAAW;;;EAgCzB"}
|
package/package.json
CHANGED
package/src/libs/feature/editor/src/lib/components/wizard-summarize/wizard-summarize.component.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@angular/core'
|
|
2
2
|
import { WizardService } from '../../services/wizard.service'
|
|
3
|
-
import {
|
|
3
|
+
import { DateService } from '../../../../../../../libs/util/shared/src'
|
|
4
4
|
|
|
5
5
|
@Component({
|
|
6
6
|
selector: 'gn-ui-wizard-summarize',
|
|
@@ -28,9 +28,8 @@ export class WizardSummarizeComponent {
|
|
|
28
28
|
|
|
29
29
|
get createdDate() {
|
|
30
30
|
const time = this.wizardService.getWizardFieldData('datepicker')
|
|
31
|
-
const locale = this.translateService.currentLang
|
|
32
31
|
|
|
33
|
-
return new Date(Number(time))
|
|
32
|
+
return this.dateService.formatDate(new Date(Number(time)), {
|
|
34
33
|
year: 'numeric',
|
|
35
34
|
month: 'long',
|
|
36
35
|
day: 'numeric',
|
|
@@ -54,6 +53,6 @@ export class WizardSummarizeComponent {
|
|
|
54
53
|
|
|
55
54
|
constructor(
|
|
56
55
|
private wizardService: WizardService,
|
|
57
|
-
private
|
|
56
|
+
private dateService: DateService
|
|
58
57
|
) {}
|
|
59
58
|
}
|
|
@@ -163,13 +163,13 @@
|
|
|
163
163
|
<div *ngIf="metadata.resourceCreated">
|
|
164
164
|
<p class="text-sm" translate>record.metadata.creation</p>
|
|
165
165
|
<p class="text-primary font-medium mt-1">
|
|
166
|
-
{{ metadata.resourceCreated
|
|
166
|
+
{{ formatDate(metadata.resourceCreated) }}
|
|
167
167
|
</p>
|
|
168
168
|
</div>
|
|
169
169
|
<div *ngIf="metadata.resourcePublished">
|
|
170
170
|
<p class="text-sm" translate>record.metadata.publication</p>
|
|
171
171
|
<p class="text-primary font-medium mt-1">
|
|
172
|
-
{{ metadata.resourcePublished
|
|
172
|
+
{{ formatDate(metadata.resourcePublished) }}
|
|
173
173
|
</p>
|
|
174
174
|
</div>
|
|
175
175
|
<div *ngIf="updateFrequency">
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
<div *ngIf="metadata.recordUpdated">
|
|
234
234
|
<p class="text-sm" translate>record.metadata.updatedOn</p>
|
|
235
235
|
<p class="text-primary font-medium">
|
|
236
|
-
{{ metadata.recordUpdated && metadata.recordUpdated
|
|
236
|
+
{{ metadata.recordUpdated && formatDateTime(metadata.recordUpdated) }}
|
|
237
237
|
</p>
|
|
238
238
|
</div>
|
|
239
239
|
<div *ngIf="metadata.landingPage">
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
DatasetRecord,
|
|
10
10
|
Keyword,
|
|
11
11
|
} from '../../../../../../libs/common/domain/src/lib/model/record'
|
|
12
|
-
import { getTemporalRangeUnion } from '../../../../../../libs/util/shared/src'
|
|
12
|
+
import { DateService, getTemporalRangeUnion } from '../../../../../../libs/util/shared/src'
|
|
13
13
|
import { MarkdownParserComponent } from '../markdown-parser/markdown-parser.component'
|
|
14
14
|
import {
|
|
15
15
|
ExpandablePanelComponent,
|
|
@@ -60,6 +60,8 @@ export class MetadataInfoComponent {
|
|
|
60
60
|
@Output() keyword = new EventEmitter<Keyword>()
|
|
61
61
|
updatedTimes: number
|
|
62
62
|
|
|
63
|
+
constructor(private dateService: DateService) {}
|
|
64
|
+
|
|
63
65
|
get hasUsage() {
|
|
64
66
|
return (
|
|
65
67
|
this.metadata.extras?.isOpenData === true ||
|
|
@@ -121,7 +123,7 @@ export class MetadataInfoComponent {
|
|
|
121
123
|
|
|
122
124
|
get temporalExtent(): { start: string; end: string } {
|
|
123
125
|
const temporalExtents = this.metadata.temporalExtents
|
|
124
|
-
return getTemporalRangeUnion(temporalExtents)
|
|
126
|
+
return getTemporalRangeUnion(temporalExtents, this.dateService)
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
get shownOrganization() {
|
|
@@ -139,4 +141,12 @@ export class MetadataInfoComponent {
|
|
|
139
141
|
onKeywordClick(keyword: Keyword) {
|
|
140
142
|
this.keyword.emit(keyword)
|
|
141
143
|
}
|
|
144
|
+
|
|
145
|
+
formatDate(date: Date): string {
|
|
146
|
+
return this.dateService.formatDate(date)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
formatDateTime(date: Date): string {
|
|
150
|
+
return this.dateService.formatDateTime(date)
|
|
151
|
+
}
|
|
142
152
|
}
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
InteractiveTableComponent,
|
|
22
22
|
} from '../../../../../../libs/ui/layout/src'
|
|
23
23
|
import {
|
|
24
|
+
DateService,
|
|
24
25
|
FileFormat,
|
|
25
26
|
formatUserInfo,
|
|
26
27
|
getBadgeColor,
|
|
@@ -86,7 +87,8 @@ export class ResultsTableComponent {
|
|
|
86
87
|
constructor(
|
|
87
88
|
private overlay: Overlay,
|
|
88
89
|
private viewContainerRef: ViewContainerRef,
|
|
89
|
-
private cdr: ChangeDetectorRef
|
|
90
|
+
private cdr: ChangeDetectorRef,
|
|
91
|
+
private dateService: DateService
|
|
90
92
|
) {}
|
|
91
93
|
|
|
92
94
|
openActionMenu(item, template) {
|
|
@@ -139,7 +141,7 @@ export class ResultsTableComponent {
|
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
dateToString(date: Date): string {
|
|
142
|
-
return date
|
|
144
|
+
return this.dateService.formatDate(date, {
|
|
143
145
|
year: 'numeric',
|
|
144
146
|
month: 'long',
|
|
145
147
|
day: 'numeric',
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core'
|
|
2
|
+
import { TranslateService } from '@ngx-translate/core'
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class DateService {
|
|
8
|
+
constructor(private translateService: TranslateService) {}
|
|
9
|
+
|
|
10
|
+
private getDateObject(date: Date | string): Date {
|
|
11
|
+
if (typeof date === 'string') {
|
|
12
|
+
const dateObj = new Date(date)
|
|
13
|
+
if (isNaN(dateObj.getTime())) {
|
|
14
|
+
throw new Error('Invalid date string')
|
|
15
|
+
}
|
|
16
|
+
return dateObj
|
|
17
|
+
}
|
|
18
|
+
return date
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private getLocaleAndDate(date: Date | string): {
|
|
22
|
+
locale: string
|
|
23
|
+
dateObj: Date
|
|
24
|
+
} {
|
|
25
|
+
const locale = this.translateService.currentLang || 'en-US'
|
|
26
|
+
const dateObj = this.getDateObject(date)
|
|
27
|
+
return { locale, dateObj }
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
formatDate(
|
|
31
|
+
date: Date | string,
|
|
32
|
+
options?: Intl.DateTimeFormatOptions
|
|
33
|
+
): string {
|
|
34
|
+
const { locale, dateObj } = this.getLocaleAndDate(date)
|
|
35
|
+
return dateObj.toLocaleDateString(locale, options)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
formatDateTime(
|
|
39
|
+
date: Date | string,
|
|
40
|
+
options?: Intl.DateTimeFormatOptions
|
|
41
|
+
): string {
|
|
42
|
+
const { locale, dateObj } = this.getLocaleAndDate(date)
|
|
43
|
+
return dateObj.toLocaleString(locale, options)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { DateService } from '../services'
|
|
2
|
+
|
|
1
3
|
export function getTemporalRangeUnion(
|
|
2
4
|
ranges: {
|
|
3
5
|
start?: Date
|
|
4
6
|
end?: Date
|
|
5
|
-
}[]
|
|
7
|
+
}[],
|
|
8
|
+
dateService: DateService
|
|
6
9
|
) {
|
|
7
10
|
let earliestStartDate = Infinity
|
|
8
11
|
let latestEndDate = -Infinity
|
|
@@ -24,11 +27,11 @@ export function getTemporalRangeUnion(
|
|
|
24
27
|
return {
|
|
25
28
|
start:
|
|
26
29
|
earliestStartDate !== -Infinity
|
|
27
|
-
? new Date(earliestStartDate)
|
|
30
|
+
? dateService.formatDate(new Date(earliestStartDate))
|
|
28
31
|
: undefined,
|
|
29
32
|
end:
|
|
30
33
|
latestEndDate !== Infinity
|
|
31
|
-
? new Date(latestEndDate)
|
|
34
|
+
? dateService.formatDate(new Date(latestEndDate))
|
|
32
35
|
: undefined,
|
|
33
36
|
}
|
|
34
37
|
} else {
|