Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Feature chart - set timeFormatter if from and to is defined, closes #74
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy authored and Andy committed Jan 7, 2020
1 parent 0ac43b5 commit 06b1770
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions components/FeatureCharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class FeatureCharts extends React.Component {
const data = getData(selectedFeature, property, timeSettings);

let timeFormatter;
if (data) {
if (timeSettings.from !== null && timeSettings.to !== null) {
const format = getDatesDiff(timeSettings) > 1 ? 'L' : 'LT';
timeFormatter = getTimeFormatter(timeSettings.timeZone, format);
}
Expand Down Expand Up @@ -196,14 +196,15 @@ class FeatureCharts extends React.Component {
}

const title = isAggregatedFeature ? null : getTitle(selectedFeature);
const { timeSettings } = this.props;
const subtitle = getTimeRangeString(timeSettings);
const data = getData(selectedFeature, nextProps.property, nextProps.timeSettings);

const nextTimeSettings = nextProps.timeSettings;
const subtitle = getTimeRangeString(nextTimeSettings);
const data = getData(selectedFeature, nextProps.property, nextTimeSettings);

let timeFormatter;
if (data) {
const format = getDatesDiff(nextProps.timeSettings) > 1 ? 'L' : 'LT';
timeFormatter = getTimeFormatter(nextProps.timeSettings.timeZone, format);
if (nextTimeSettings.from !== null && nextTimeSettings.to !== null) {
const format = getDatesDiff(nextTimeSettings) > 1 ? 'L' : 'LT';
timeFormatter = getTimeFormatter(nextTimeSettings.timeZone, format);
}

this.setState(
Expand Down

0 comments on commit 06b1770

Please sign in to comment.