我正在使用react-date-range-picker选择日期范围。我想为此设置不同的时区(America / Los_Angeles)日期。 .moment()。tz()返回正确的日期。但是日期范围选择系统日期
import { DateRangePicker } from "react-date-range";
import moment from "moment-timezone";
import 'react-date-range/dist/styles.css'; // main style file
import 'react-date-range/dist/theme/default.css'; // theme css file
moment.tz.setDefault("America/Los_Angeles");
function App() {
const selectionRange = {
startDate: moment().tz('America/Los_Angeles'),
endDate: moment().tz('America/Los_Angeles'),
key: "selection"
};
return (
<div className="App">
<DateRangePicker
ranges={[selectionRange]}
onChange={ranges => {
console.log(ranges);
console.log(selectionRange);
}}
></DateRangePicker>
</div>
);
}
export default App;