Skip to content

Commit b1128c8

Browse files
Compute label for voltage init modification (#959)
Signed-off-by: Franck LECUYER <franck.lecuyer@rte-france.com>
1 parent ef3a1fe commit b1128c8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/hooks/useModificationLabelComputer.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,20 @@ export const useModificationLabelComputer = () => {
101101
case MODIFICATION_TYPES.CREATE_VOLTAGE_LEVEL_SECTION.type:
102102
case MODIFICATION_TYPES.MOVE_VOLTAGE_LEVEL_FEEDER_BAYS.type:
103103
return modificationMetadata.voltageLevelId;
104+
case MODIFICATION_TYPES.VOLTAGE_INIT_MODIFICATION.type:
105+
if (
106+
modificationMetadata.rootNetworkName &&
107+
modificationMetadata.nodeName &&
108+
modificationMetadata.computationDate
109+
) {
110+
const computedDateFormatted = new Intl.DateTimeFormat(intl.locale, {
111+
dateStyle: 'long',
112+
timeStyle: 'long',
113+
hour12: false,
114+
}).format(new Date(modificationMetadata.computationDate));
115+
return `: ${modificationMetadata.rootNetworkName} / ${modificationMetadata.nodeName} / ${computedDateFormatted}`;
116+
}
117+
return '';
104118
default:
105119
return modificationMetadata.equipmentId || '';
106120
}

0 commit comments

Comments
 (0)