From 527cbb0b4b7828bcd4cd94641301a40cf39c10b9 Mon Sep 17 00:00:00 2001 From: Sebastian Aranda Sanchez Date: Thu, 19 Dec 2024 11:18:01 -0300 Subject: [PATCH 1/2] Convert narrativelog date_begin and date_end TAI datetimes to UTC. --- .../OLE/NonExposure/NonExposure.jsx | 22 ++++++++++++++----- love/src/components/OLE/OLE.container.jsx | 10 ++++++++- love/src/components/OLE/OLE.jsx | 2 ++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/love/src/components/OLE/NonExposure/NonExposure.jsx b/love/src/components/OLE/NonExposure/NonExposure.jsx index 1d2968e96..212a39141 100644 --- a/love/src/components/OLE/NonExposure/NonExposure.jsx +++ b/love/src/components/OLE/NonExposure/NonExposure.jsx @@ -87,6 +87,8 @@ export default class NonExposure extends Component { changeObsTimeLossSelect: PropTypes.func, /** Function to handle the jira ticket filter */ changeJiraTicketsSelect: PropTypes.func, + /** Difference in seconds between UTC and TAI */ + taiToUtc: PropTypes.number, }; static defaultProps = { @@ -160,24 +162,32 @@ export default class NonExposure extends Component { } getHeaders = () => { + const { taiToUtc } = this.props; + return [ { field: 'date_begin', title: 'Time of incident (UTC)', type: 'string', className: styles.tableHead, - render: (value) => moment(value).format(ISO_STRING_DATE_TIME_FORMAT), + render: (value) => moment(value).add(taiToUtc, 'seconds').format(ISO_STRING_DATE_TIME_FORMAT), }, { field: 'time_lost', title: 'Obs. Time Loss', type: 'string', className: styles.tableHead, - render: (value, row) => ( - - {formatSecondsToDigital(value * 3600)} - - ), + render: (value, row) => { + const dateBeginUTC = moment(row.date_begin).add(taiToUtc, 'seconds'); + const dateEndUTC = moment(row.date_end).add(taiToUtc, 'seconds'); + const dateBeginUTCString = dateBeginUTC.format(ISO_STRING_DATE_TIME_FORMAT); + const dateEndUTCString = dateEndUTC.format(ISO_STRING_DATE_TIME_FORMAT); + return ( + + {formatSecondsToDigital(value * 3600)} + + ); + }, }, { field: 'date_begin', diff --git a/love/src/components/OLE/OLE.container.jsx b/love/src/components/OLE/OLE.container.jsx index 4c597216b..b9fa1a153 100644 --- a/love/src/components/OLE/OLE.container.jsx +++ b/love/src/components/OLE/OLE.container.jsx @@ -21,6 +21,7 @@ import React from 'react'; import { connect } from 'react-redux'; import SubscriptionTableContainer from 'components/GeneralPurpose/SubscriptionTable/SubscriptionTable.container'; import { addGroup, removeGroup } from 'redux/actions/ws'; +import { getTaiToUtc } from 'redux/selectors'; import OLE from './OLE'; export const schema = { @@ -62,6 +63,13 @@ const OLEContainer = ({ subscribeToStreams, unsubscribeToStreams, ...props }) => ); }; +const mapStateToProps = (state) => { + const taiToUtc = getTaiToUtc(state); + return { + taiToUtc, + }; +}; + const mapDispatchToProps = (dispatch) => { const subscriptions = []; return { @@ -75,4 +83,4 @@ const mapDispatchToProps = (dispatch) => { }; }; -export default connect(null, mapDispatchToProps)(OLEContainer); +export default connect(mapStateToProps, mapDispatchToProps)(OLEContainer); diff --git a/love/src/components/OLE/OLE.jsx b/love/src/components/OLE/OLE.jsx index e0878cd2c..09198d458 100644 --- a/love/src/components/OLE/OLE.jsx +++ b/love/src/components/OLE/OLE.jsx @@ -105,6 +105,7 @@ export default class OLE extends Component { } getComponent(clickNewLog, tab) { + const { taiToUtc } = this.props; if (clickNewLog === true) { if (tab === 'exposure') { return ( @@ -158,6 +159,7 @@ export default class OLE extends Component { changeObsTimeLossSelect={(value) => this.changeObsTimeLossSelect(value)} selectedJiraTickets={this.state.selectedJiraTickets} changeJiraTicketsSelect={(value) => this.changeJiraTicketsSelect(value)} + taiToUtc={taiToUtc} /> ); } From 9fe56a87e7fb1521a9608b4f6db53d0b453cf21f Mon Sep 17 00:00:00 2001 From: Sebastian Aranda Sanchez Date: Thu, 19 Dec 2024 11:26:19 -0300 Subject: [PATCH 2/2] Update CHANGELOG. --- CHANGELOG.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 90e1316b4..7a4d42995 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,7 @@ Version History v6.5.0 ------ +* Convert narrativelog date_begin and date_end TAI datetimes to UTC. ``_ * Extend ScriptQueue ConfigPanel component to load scripts schemas on demand. ``_ v6.4.1