2022-03-03 21:46:53 +00:00
|
|
|
import moment from 'moment';
|
2023-09-26 14:33:53 +00:00
|
|
|
import React from 'react';
|
2022-03-03 21:46:53 +00:00
|
|
|
|
|
|
|
import I18n from '../../i18n';
|
2023-09-26 14:33:53 +00:00
|
|
|
import { useAppSelector } from '../../lib/hooks';
|
2022-03-03 21:46:53 +00:00
|
|
|
import Item from './Item';
|
|
|
|
|
2023-09-26 14:33:53 +00:00
|
|
|
const Timezone = ({ utcOffset }: { utcOffset?: number }): React.ReactElement | null => {
|
|
|
|
const Message_TimeFormat = useAppSelector(state => state.settings.Message_TimeFormat as string);
|
2022-03-03 21:46:53 +00:00
|
|
|
|
2023-09-26 14:33:53 +00:00
|
|
|
if (!utcOffset) return null;
|
2022-03-03 21:46:53 +00:00
|
|
|
|
|
|
|
return (
|
2023-09-26 14:33:53 +00:00
|
|
|
<Item label={I18n.t('Timezone')} content={`${moment().utcOffset(utcOffset).format(Message_TimeFormat)} (UTC ${utcOffset})`} />
|
2022-03-03 21:46:53 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-09-26 14:33:53 +00:00
|
|
|
export default Timezone;
|