From 9034832b9d97bb2411610db7daf6d1eba99a5131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Tue, 6 Feb 2024 14:45:04 +0100 Subject: [PATCH] fix(studio): Set default observation year to the not embargo one /2 --- src/components/Studio/index.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/Studio/index.js b/src/components/Studio/index.js index 06029e86..a6c3f1bd 100644 --- a/src/components/Studio/index.js +++ b/src/components/Studio/index.js @@ -11,7 +11,7 @@ import { CopyToClipboard } from 'react-copy-to-clipboard'; import { useIntl } from 'react-intl'; import downloadFile from '../../utils/files'; -import { getCSSValue } from '../../utils/helpers'; +import { getCSSValue, getObservationLabel } from '../../utils/helpers'; import useGlobals from '../../utils/Hooks/useGetGlobals'; import tree from './tree'; @@ -26,9 +26,11 @@ const Studio = () => { const [firstObservationYear, setFirstObservationYear] = useState(2018); const [lang, setLang] = useState('fr'); const [lastObservationYear, setLastObservationYear] = useState( - lastObservationSnap > process.env.REACT_APP_LAST_OBSERVATION - ? process.env.REACT_APP_LAST_OBSERVATION - : lastObservationSnap, + getObservationLabel( + lastObservationSnap > process.env.REACT_APP_LAST_OBSERVATION + ? process.env.REACT_APP_LAST_OBSERVATION + : lastObservationSnap, + ), ); const [object, setObject] = useState('publi'); const [startYear, setStartYear] = useState(2013);