FeatEtcGMT.tsx 867 B

123456789101112131415161718192021222324252627
  1. import React, { useMemo } from 'react';
  2. import { DatePicker, Space } from '@douyinfe/semi-ui';
  3. App.storyName = 'timeZone Etc/GMT*';
  4. /**
  5. * test with chromatic
  6. * @see https://github.com/DouyinFE/semi-design/issues/1585
  7. */
  8. export default function App(props = {}) {
  9. const gmtList = useMemo(() => {
  10. const list = [];
  11. for (let hourOffset = -11; hourOffset <= 14; hourOffset++) {
  12. const prefix = hourOffset >= 0 ? '+' : '-';
  13. const hOffset = Math.abs(parseInt(hourOffset, 10));
  14. list.push(`GMT${prefix}${String(hOffset).padStart(2, '0')}:00`);
  15. }
  16. return list;
  17. }, []);
  18. return (
  19. <Space vertical>
  20. {gmtList.map(gmt => (
  21. <DatePicker key={gmt} prefix={gmt} timeZone={gmt} type={'dateTime'} defaultValue={1683084540000} />
  22. ))}
  23. </Space>
  24. );
  25. }