File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
packages/ui-date-input/src/DateInput2 Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -214,21 +214,21 @@ const DateInput2 = ({
214214 return date ? [ formatDate ( date ) , date . toISOString ( ) ] : [ '' , '' ]
215215 }
216216
217- const formatDate = ( date : Date ) : string => {
217+ const formatDate = ( date : Date , timeZone : string = getTimezone ( ) ) : string => {
218218 // use formatter function if provided
219219 if ( typeof dateFormat !== 'string' && dateFormat ?. formatter ) {
220220 return dateFormat . formatter ( date )
221221 }
222222 // if dateFormat set to a locale, use that, otherwise default to the user's locale
223223 return date . toLocaleDateString (
224224 typeof dateFormat === 'string' ? dateFormat : getLocale ( ) ,
225- { timeZone : getTimezone ( ) , calendar : 'gregory' , numberingSystem : 'latn' }
225+ { timeZone, calendar : 'gregory' , numberingSystem : 'latn' }
226226 )
227227 }
228228
229229 const getDateFromatHint = ( ) => {
230230 const exampleDate = new Date ( '2024-09-01' )
231- const formattedDate = formatDate ( exampleDate )
231+ const formattedDate = formatDate ( exampleDate , 'UTC' ) // exampleDate is in UTC so format it as such
232232
233233 // Create a regular expression to find the exact match of the number
234234 const regex = ( n : string ) => {
You can’t perform that action at this time.
0 commit comments