File tree Expand file tree Collapse file tree 2 files changed +20
-14
lines changed
client/packages/lowcoder/src/comps/comps/dateComp Expand file tree Collapse file tree 2 files changed +20
-14
lines changed Original file line number Diff line number Diff line change @@ -462,13 +462,16 @@ export const dateRangeControl = (function () {
462462 . build ( ) ;
463463} ) ( ) ;
464464
465- const getTimeZoneInfo = ( timeZone : any , othereTimeZone : any ) => {
466- const tz = timeZone === 'UserChoice' ? othereTimeZone : timeZone ;
467- return {
468- TimeZone : tz ,
469- Offset : dayjs ( ) . tz ( tz ) . format ( 'Z' ) // Get the UTC offset for the selected timezone
470- } ;
471- } ;
465+ const getTimeZoneInfo = ( timeZone : any , otherTimeZone : any ) => {
466+ const tz = timeZone === 'UserChoice' ? otherTimeZone : timeZone ;
467+
468+ const dateInTz = dayjs ( ) . tz ( tz ) ;
469+ const offset = dateInTz . format ( 'Z' ) ;
470+ const timeZoneName = new Intl . DateTimeFormat ( 'en-US' , { timeZone : tz , timeZoneName : 'short' } )
471+ . formatToParts ( ) . find ( part => part . type === 'timeZoneName' ) ?. value ;
472+
473+ return { TimeZone : tz , Offset : offset , Name : timeZoneName } ;
474+ } ;
472475
473476export const DatePickerComp = withExposingConfigs ( datePickerControl , [
474477 depsConfig ( {
Original file line number Diff line number Diff line change @@ -414,13 +414,16 @@ export const timeRangeControl = (function () {
414414 . build ( ) ;
415415} ) ( ) ;
416416
417- const getTimeZoneInfo = ( timeZone : any , othereTimeZone : any ) => {
418- const tz = timeZone === 'UserChoice' ? othereTimeZone : timeZone ;
419- return {
420- TimeZone : tz ,
421- Offset : dayjs ( ) . tz ( tz ) . format ( 'Z' ) // Get the UTC offset for the selected timezone
422- } ;
423- } ;
417+ const getTimeZoneInfo = ( timeZone : any , otherTimeZone : any ) => {
418+ const tz = timeZone === 'UserChoice' ? otherTimeZone : timeZone ;
419+
420+ const dateInTz = dayjs ( ) . tz ( tz ) ;
421+ const offset = dateInTz . format ( 'Z' ) ;
422+ const timeZoneName = new Intl . DateTimeFormat ( 'en-US' , { timeZone : tz , timeZoneName : 'short' } )
423+ . formatToParts ( ) . find ( part => part . type === 'timeZoneName' ) ?. value ;
424+
425+ return { TimeZone : tz , Offset : offset , Name : timeZoneName } ;
426+ } ;
424427
425428export const TimePickerComp = withExposingConfigs ( timePickerControl , [
426429 new NameConfig ( "value" , trans ( "export.timePickerValueDesc" ) ) ,
You can’t perform that action at this time.
0 commit comments