Skip to content

Commit 56a5588

Browse files
committed
added timeZone dropdown in right panel
1 parent 84042b7 commit 56a5588

File tree

3 files changed

+77
-1
lines changed

3 files changed

+77
-1
lines changed

client/packages/lowcoder-comps/src/comps/calendarComp/calendarComp.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ import {
7979
resourceTimeGridHeaderToolbar,
8080
} from "./calendarConstants";
8181
import { EventOptionControl } from "./eventOptionsControl";
82+
import { timeZoneOptions } from "./timeZone";
8283

8384
function fixOldData(oldData: any) {
8485
if(!Boolean(oldData)) return;
@@ -150,6 +151,7 @@ let childrenMap: any = {
150151
currentFreeView: dropdownControl(DefaultWithFreeViewOptions, "timeGridWeek"),
151152
currentPremiumView: dropdownControl(DefaultWithPremiumViewOptions, "resourceTimelineDay"),
152153
animationStyle: styleControl(AnimationStyle, 'animationStyle'),
154+
timeZone: dropdownControl(timeZoneOptions, Intl.DateTimeFormat().resolvedOptions().timeZone),
153155
};
154156

155157
// this should ensure backwards compatibility with older versions of the SDK
@@ -187,7 +189,8 @@ let CalendarBasicComp = (function () {
187189
currentFreeView?: string;
188190
currentPremiumView?: string;
189191
animationStyle?:any;
190-
modalStyle?:any
192+
modalStyle?:any;
193+
timeZone?: string;
191194
}) => {
192195
const comp = useContext(EditorContext)?.getUICompByName(
193196
useContext(CompNameContext)
@@ -315,6 +318,7 @@ let CalendarBasicComp = (function () {
315318
licenseKey,
316319
resourceName,
317320
modalStyle,
321+
timeZone
318322
} = props;
319323

320324
const handleEventDataChange = useCallback((data: Array<Record<string,any>>) => {
@@ -890,6 +894,7 @@ let CalendarBasicComp = (function () {
890894
animationStyle: { getPropertyView: () => any; };
891895
modalStyle: { getPropertyView: () => any; };
892896
licenseKey: { getView: () => any; propertyView: (arg0: { label: string; tooltip: string; }) => any; };
897+
timeZone: { propertyView: (arg0: { label: string; }) => any; };
893898
}) => {
894899
const license = children.licenseKey.getView();
895900

@@ -904,6 +909,9 @@ let CalendarBasicComp = (function () {
904909
title: "Events",
905910
newOptionLabel: "Event",
906911
})}
912+
{children.timeZone.propertyView({
913+
label: trans("calendar.timeZone")
914+
})}
907915
</Section>
908916
{ license != "" &&
909917
<Section name={trans("calendar.resources")}>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { trans } from "../../i18n/comps";
2+
3+
export const timeZoneOptions = [
4+
{ label: trans("timeZone.UserChoice"), value: "UserChoice" },
5+
{ label: trans("timeZone.UTC-12:00"), value: "Pacific/Baker" },
6+
{ label: trans("timeZone.UTC-11:00"), value: "Pacific/Niue" },
7+
{ label: trans("timeZone.UTC-10:00"), value: "Pacific/Honolulu" },
8+
{ label: trans("timeZone.UTC-09:00"), value: "America/Anchorage" },
9+
{ label: trans("timeZone.UTC-08:00"), value: "America/Tijuana" },
10+
{ label: trans("timeZone.UTC-07:00"), value: "America/Los_Angeles" },
11+
{ label: trans("timeZone.UTC-06:00"), value: "America/Chicago" },
12+
{ label: trans("timeZone.UTC-05:00"), value: "America/New_York" },
13+
{ label: trans("timeZone.UTC-04:00"), value: "America/Halifax" },
14+
{ label: trans("timeZone.UTC-03:00"), value: "America/Argentina/Buenos_Aires" },
15+
{ label: trans("timeZone.UTC-02:00"), value: "Atlantic/South_Georgia" },
16+
{ label: trans("timeZone.UTC-01:00"), value: "Atlantic/Cape_Verde" },
17+
{ label: trans("timeZone.UTC+00:00"), value: "Etc/UTC" },
18+
{ label: trans("timeZone.UTC+01:00"), value: "Europe/Berlin" },
19+
{ label: trans("timeZone.UTC+02:00"), value: "Europe/Bucharest" },
20+
{ label: trans("timeZone.UTC+03:00"), value: "Europe/Moscow" },
21+
{ label: trans("timeZone.UTC+04:00"), value: "Asia/Dubai" },
22+
{ label: trans("timeZone.UTC+05:00"), value: "Asia/Karachi" },
23+
{ label: trans("timeZone.UTC+05:30"), value: "Asia/Kolkata" },
24+
{ label: trans("timeZone.UTC+05:45"), value: "Asia/Kathmandu" },
25+
{ label: trans("timeZone.UTC+06:00"), value: "Asia/Dhaka" },
26+
{ label: trans("timeZone.UTC+06:30"), value: "Asia/Rangoon" },
27+
{ label: trans("timeZone.UTC+07:00"), value: "Asia/Bangkok" },
28+
{ label: trans("timeZone.UTC+08:00"), value: "Asia/Shanghai" },
29+
{ label: trans("timeZone.UTC+09:00"), value: "Asia/Tokyo" },
30+
{ label: trans("timeZone.UTC+09:30"), value: "Australia/Darwin" },
31+
{ label: trans("timeZone.UTC+10:00"), value: "Australia/Sydney" },
32+
{ label: trans("timeZone.UTC+11:00"), value: "Pacific/Guadalcanal" },
33+
{ label: trans("timeZone.UTC+12:00"), value: "Pacific/Auckland" },
34+
{ label: trans("timeZone.UTC+13:00"), value: "Pacific/Tongatapu" },
35+
];

client/packages/lowcoder-comps/src/i18n/comps/locales/en.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,5 +350,38 @@ export const en = {
350350
timeZone:"Time Zone",
351351
timeRange:"Time Range",
352352
},
353+
timeZone: {
354+
"UTC-12:00": "(UTC-12:00) Int'l Date Line W",
355+
"UTC-11:00": "(UTC-11:00) UTC-11",
356+
"UTC-10:00": "(UTC-10:00) Hawaii",
357+
"UTC-09:00": "(UTC-09:00) Alaska",
358+
"UTC-08:00": "(UTC-08:00) Baja CA",
359+
"UTC-07:00": "(UTC-07:00) Pacific Time (US)",
360+
"UTC-06:00": "(UTC-06:00) Central Time (US)",
361+
"UTC-05:00": "(UTC-05:00) Eastern Time (US)",
362+
"UTC-04:00": "(UTC-04:00) Atlantic Time",
363+
"UTC-03:00": "(UTC-03:00) Buenos Aires",
364+
"UTC-02:00": "(UTC-02:00) UTC-02",
365+
"UTC-01:00": "(UTC-01:00) Cape Verde",
366+
"UTC+00:00": "(UTC 00:00) UTC",
367+
"UTC+01:00": "(UTC+01:00) Berlin, Rome",
368+
"UTC+02:00": "(UTC+02:00) Athens, Bucharest",
369+
"UTC+03:00": "(UTC+03:00) Moscow",
370+
"UTC+04:00": "(UTC+04:00) Dubai, Muscat",
371+
"UTC+05:00": "(UTC+05:00) Karachi",
372+
"UTC+05:30": "(UTC+05:30) New Delhi",
373+
"UTC+05:45": "(UTC+05:45) Kathmandu",
374+
"UTC+06:00": "(UTC+06:00) Dhaka",
375+
"UTC+06:30": "(UTC+06:30) Yangon",
376+
"UTC+07:00": "(UTC+07:00) Bangkok",
377+
"UTC+08:00": "(UTC+08:00) Beijing, HK",
378+
"UTC+09:00": "(UTC+09:00) Tokyo, Seoul",
379+
"UTC+09:30": "(UTC+09:30) Adelaide, Darwin",
380+
"UTC+10:00": "(UTC+10:00) Sydney",
381+
"UTC+11:00": "(UTC+11:00) Solomon Islands, New Caledonia",
382+
"UTC+12:00": "(UTC+12:00) Auckland, Fiji",
383+
"UTC+13:00": "(UTC+13:00) Nuku'alofa, Samoa",
384+
"UserChoice": "UserChoice"
385+
},
353386
};
354387

0 commit comments

Comments
 (0)