我想使用link中的Highcharts getTimezoneOffset
,
但显示错误moment_1.default.tz is not a function
。
这是代码:
const config = {
rangeSelector: {
selected: 1
},
title: {
text: 'aAAPL Stock Price'
},
series: [{
name: 'AAPL',
data: data,
tooltip: {
valueDecimals: 2
}
}],
time: {
getTimezoneOffset: function (timestamp) {
var zone = 'Europe/Oslo',
timezoneOffset = -moment.tz(timestamp, zone).utcOffset();
return timezoneOffset;
}
}
};
class App extends Component {
render() {
const { dataResults } = this.state;
const chartConfig = getConfig(dataResults);
return <ReactHighstock config={chartConfig} />
}
}
export default App;
render(<ReactHighstock config={config}/>,
document.getElementById('root'));
完整代码link
有人可以帮助我解决这个问题吗?