File tree 2 files changed +20
-14
lines changed
client/packages/lowcoder/src/comps/comps/dateComp
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 () {
462
462
. build ( ) ;
463
463
} ) ( ) ;
464
464
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
+ } ;
472
475
473
476
export const DatePickerComp = withExposingConfigs ( datePickerControl , [
474
477
depsConfig ( {
Original file line number Diff line number Diff line change @@ -414,13 +414,16 @@ export const timeRangeControl = (function () {
414
414
. build ( ) ;
415
415
} ) ( ) ;
416
416
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
+ } ;
424
427
425
428
export const TimePickerComp = withExposingConfigs ( timePickerControl , [
426
429
new NameConfig ( "value" , trans ( "export.timePickerValueDesc" ) ) ,
You can’t perform that action at this time.
0 commit comments