Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e46c611

Browse files
added timeZone name in JSON obj
1 parent 1cf868e commit e46c611

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

‎client/packages/lowcoder/src/comps/comps/dateComp/dateComp.tsx‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff 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

473476
export const DatePickerComp = withExposingConfigs(datePickerControl, [
474477
depsConfig({

‎client/packages/lowcoder/src/comps/comps/dateComp/timeComp.tsx‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff 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

425428
export const TimePickerComp = withExposingConfigs(timePickerControl, [
426429
new NameConfig("value", trans("export.timePickerValueDesc")),

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /