import * as React from 'react'; import { TimePicker, Text, IStackTokens, Stack, IStackStyles, IComboBoxStyles } from '@fluentui/react'; const stackStyles: Partial = { root: { width: 500 } }; const stackTokens: IStackTokens = { childrenGap: 20 }; const timePickerStyles: Partial = { optionsContainerWrapper: { height: '500px', }, root: { width: '500px', }, }; export const TimePickerCustomTimeStringsExample: React.FC = () => { const [customTimeString, setCustomTimeString] = React.useState(''); const dateAnchor = new Date('February 27, 2023 08:00:00'); const onFormatDate = React.useCallback((date: Date) => `Custom prefix + ${date.toLocaleTimeString()}`, []); const onValidateUserInput = React.useCallback((userInput: string) => { if (!userInput.includes('Custom prefix +')) { return 'Your input is missing "Custom prefix +"'; } return ''; }, []); const onChange = React.useCallback((_: any, time: Date) => { console.log('Selected time: ', time); setCustomTimeString(time.toString()); }, []); return ( {`⚓ Date anchor: ${dateAnchor.toString()}`} {`⌚ Selected time: ${customTimeString ? customTimeString : ''}`} ); };