1
0
mirror of https://github.com/kremalicious/umami.git synced 2024-12-23 18:04:47 +01:00
umami/components/settings/TimezoneSetting.js

32 lines
927 B
JavaScript
Raw Normal View History

import React from 'react';
import { FormattedMessage } from 'react-intl';
import { listTimeZones } from 'timezone-support';
2020-09-20 10:33:39 +02:00
import DropDown from 'components/common/DropDown';
import Button from 'components/common/Button';
import useTimezone from 'hooks/useTimezone';
import { getTimezone } from 'lib/date';
import styles from './TimezoneSetting.module.css';
export default function TimezoneSetting() {
const [timezone, saveTimezone] = useTimezone();
const options = listTimeZones().map(n => ({ label: n, value: n }));
function handleReset() {
saveTimezone(getTimezone());
}
return (
<>
<DropDown
menuClassName={styles.menu}
value={timezone}
options={options}
onChange={saveTimezone}
/>
<Button className={styles.button} size="small" onClick={handleReset}>
2020-10-13 07:53:59 +02:00
<FormattedMessage id="label.reset" defaultMessage="Reset" />
</Button>
</>
);
}