@sanity/rich-date-input 0.147.10-next.23 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +67 -32
- package/dist/index.d.ts +36 -0
- package/dist/index.esm.js +256 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +261 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -25
- package/sanity.json +2 -15
- package/src/components/RelativeDateTimePicker.tsx +56 -0
- package/src/components/RichDateInput.tsx +58 -0
- package/src/components/TimezoneButton.tsx +30 -0
- package/src/components/TimezoneSelector.tsx +82 -0
- package/src/index.ts +12 -0
- package/src/schema.ts +61 -0
- package/src/types/index.ts +17 -0
- package/src/utils/index.ts +39 -0
- package/v2-incompatible.js +11 -0
- package/lib/RichDate.css +0 -28
- package/lib/RichDate.js +0 -163
- package/lib/index.js +0 -23
- package/lib/schema.js +0 -36
- package/lib/story.js +0 -42
- package/lib/util.js +0 -52
- package/schema.js +0 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,48 +1,83 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
> This is a **Sanity Studio v3** plugin.
|
|
2
|
+
|
|
3
|
+
# V3 Rich Date Input
|
|
4
|
+
|
|
5
|
+
Provides a timezone-aware date input for Sanity Studio.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install sanity-plugin-v3-rich-date-input
|
|
13
|
+
```
|
|
3
14
|
|
|
4
15
|
## Usage
|
|
5
16
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
Add it as a plugin in `sanity.config.ts` (or .js):
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {defineConfig} from 'sanity'
|
|
21
|
+
import {richDate} from 'sanity-plugin-v3-rich-date-input'
|
|
10
22
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
richDate
|
|
17
|
-
]
|
|
18
|
-
})
|
|
23
|
+
export default defineConfig({
|
|
24
|
+
//...
|
|
25
|
+
plugins: [richDate()],
|
|
26
|
+
})
|
|
27
|
+
```
|
|
19
28
|
|
|
20
|
-
|
|
29
|
+
Then, use `richDate` as a type in your schema:
|
|
21
30
|
|
|
22
|
-
|
|
31
|
+
```ts
|
|
32
|
+
import {defineField, defineType} from 'sanity'
|
|
33
|
+
|
|
34
|
+
export default defineType({
|
|
35
|
+
name: 'event',
|
|
36
|
+
title: 'Event',
|
|
37
|
+
type: 'document',
|
|
38
|
+
fields: [
|
|
39
|
+
def{
|
|
40
|
+
name: 'scheduledAt',
|
|
41
|
+
title: 'Scheduled at',
|
|
42
|
+
type: 'richDate',
|
|
43
|
+
//this will take the same options available on the datetime type: https://www.sanity.io/docs/datetime-type
|
|
44
|
+
options: {
|
|
45
|
+
timeStep: 30
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
})
|
|
50
|
+
```
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
When a user selects a date, the timezone will be stored in the document. They can choose a different timezone, if desired. The date displayed will be the time as it would be in that timezone. UTC will be calculated from the timezone and local time.
|
|
53
|
+
|
|
54
|
+
The typical data output should be:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
25
57
|
{
|
|
26
58
|
_type: 'richDate',
|
|
27
|
-
local: '
|
|
28
|
-
utc: '
|
|
59
|
+
local: '2023-02-21T10:15:00+01:00',
|
|
60
|
+
utc: '2023-02-12T09:15:00Z',
|
|
29
61
|
timezone: 'Europe/Oslo',
|
|
30
62
|
offset: 60
|
|
31
63
|
}
|
|
32
64
|
```
|
|
33
65
|
|
|
34
|
-
##
|
|
66
|
+
## License
|
|
35
67
|
|
|
36
|
-
|
|
68
|
+
[MIT](LICENSE) © Sanity.io
|
|
37
69
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
70
|
+
## Develop & test
|
|
71
|
+
|
|
72
|
+
This plugin uses [@sanity/plugin-kit](https://github.com/sanity-io/plugin-kit)
|
|
73
|
+
with default configuration for build & watch scripts.
|
|
74
|
+
|
|
75
|
+
See [Testing a plugin in Sanity Studio](https://github.com/sanity-io/plugin-kit#testing-a-plugin-in-sanity-studio)
|
|
76
|
+
on how to run this plugin with hotreload in the studio.
|
|
77
|
+
|
|
78
|
+
### Release new version
|
|
79
|
+
|
|
80
|
+
Run ["CI & Release" workflow](https://github.com/sanity-io/v3-rich-date-input/actions/workflows/main.yml).
|
|
81
|
+
Make sure to select the main branch and check "Release new version".
|
|
82
|
+
|
|
83
|
+
Semantic release will only release on configured branches, so it is safe to run release on any branch.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {DatetimeDefinition} from 'sanity'
|
|
2
|
+
import {ObjectDefinition} from 'sanity'
|
|
3
|
+
import {ObjectSchemaType} from 'sanity'
|
|
4
|
+
import {Plugin as Plugin_2} from 'sanity'
|
|
5
|
+
|
|
6
|
+
export declare interface RichDate {
|
|
7
|
+
local: string
|
|
8
|
+
utc: string
|
|
9
|
+
timezone: string
|
|
10
|
+
offset: number
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare const richDate: Plugin_2<void>
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare interface RichDateDefinition
|
|
19
|
+
extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {
|
|
20
|
+
type: typeof richDateTypeName
|
|
21
|
+
options?: DatetimeDefinition['options']
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export declare type RichDateSchemaType = Omit<ObjectSchemaType, 'options'> & {
|
|
25
|
+
options?: DatetimeDefinition['options']
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare const richDateTypeName: 'richDate'
|
|
29
|
+
|
|
30
|
+
export {}
|
|
31
|
+
|
|
32
|
+
declare module 'sanity' {
|
|
33
|
+
interface IntrinsicDefinitions {
|
|
34
|
+
richDate: RichDateDefinition
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { DateTimeInput, unset, set, ObjectInputMember, defineType, defineField, definePlugin } from 'sanity';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { Box, Autocomplete, Card, Text, Button, Flex, Dialog } from '@sanity/ui';
|
|
4
|
+
import { getTimeZones } from '@vvo/tzdb';
|
|
5
|
+
import { formatInTimeZone, zonedTimeToUtc } from 'date-fns-tz';
|
|
6
|
+
import { SearchIcon, EarthAmericasIcon } from '@sanity/icons';
|
|
7
|
+
import { useState, useCallback } from 'react';
|
|
8
|
+
const unlocalizeDateTime = (datetime, timezone) => {
|
|
9
|
+
return formatInTimeZone(datetime, timezone, "yyyy-MM-dd HH:mm:ss");
|
|
10
|
+
};
|
|
11
|
+
const getConstructedUTCDate = (utc, offset) => {
|
|
12
|
+
const date = new Date(utc);
|
|
13
|
+
const currentOffset = /* @__PURE__ */new Date().getTimezoneOffset() * -1;
|
|
14
|
+
const diff = currentOffset - offset;
|
|
15
|
+
const fakeUTCDate = new Date(date.getTime() - diff * 60 * 1e3);
|
|
16
|
+
return fakeUTCDate.toISOString();
|
|
17
|
+
};
|
|
18
|
+
const allTimezones = getTimeZones().map(tz => {
|
|
19
|
+
return {
|
|
20
|
+
abbreviation: tz.abbreviation,
|
|
21
|
+
alternativeName: tz.alternativeName,
|
|
22
|
+
mainCities: tz.mainCities.join(", "),
|
|
23
|
+
// Main time zone name 'Africa/Dar_es_Salaam'
|
|
24
|
+
name: tz.name,
|
|
25
|
+
// Time zone name with underscores removed
|
|
26
|
+
namePretty: tz.name.replaceAll("_", " "),
|
|
27
|
+
offset: tz.currentTimeFormat.split(" ")[0],
|
|
28
|
+
// all searchable text - this is transformed before being rendered in `<AutoComplete>`
|
|
29
|
+
value: "".concat(tz.currentTimeFormat, " ").concat(tz.abbreviation, " ").concat(tz.name),
|
|
30
|
+
currentTimeOffsetInMinutes: tz.currentTimeOffsetInMinutes
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
const RelativeDateTimePicker = props => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
const value = props.dateValue;
|
|
36
|
+
const timezone = (_a = value == null ? void 0 : value.timezone) != null ? _a : Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
37
|
+
const offset = (_b = value == null ? void 0 : value.offset) != null ? _b : /* @__PURE__ */new Date().getTimezoneOffset() * -1;
|
|
38
|
+
const handleDateChange = patch => {
|
|
39
|
+
const patches = [];
|
|
40
|
+
const newDatetime = patch == null ? void 0 : patch.value;
|
|
41
|
+
if (!newDatetime || !("type" in patch) || patch.type !== "set") {
|
|
42
|
+
props.onChange(unset());
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const desiredDateTime = unlocalizeDateTime(newDatetime, Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
46
|
+
const utcDate = zonedTimeToUtc(desiredDateTime, timezone).toISOString();
|
|
47
|
+
const localDate = formatInTimeZone(utcDate, timezone, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
48
|
+
patches.push(set(utcDate, ["utc"]));
|
|
49
|
+
patches.push(set(localDate, ["local"]));
|
|
50
|
+
if (!(value == null ? void 0 : value.timezone)) {
|
|
51
|
+
patches.push(set(timezone, ["timezone"]));
|
|
52
|
+
}
|
|
53
|
+
if (!(value == null ? void 0 : value.offset)) {
|
|
54
|
+
patches.push(set(offset, ["offset"]));
|
|
55
|
+
}
|
|
56
|
+
props.onChange(patches);
|
|
57
|
+
};
|
|
58
|
+
const dateToDisplay = (value == null ? void 0 : value.utc) ? getConstructedUTCDate(value.utc, value.offset) : "";
|
|
59
|
+
return /* @__PURE__ */jsx(DateTimeInput, {
|
|
60
|
+
...props,
|
|
61
|
+
onChange: handleDateChange,
|
|
62
|
+
value: dateToDisplay
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const TimezoneSelector = props => {
|
|
66
|
+
var _a;
|
|
67
|
+
const {
|
|
68
|
+
onChange,
|
|
69
|
+
value
|
|
70
|
+
} = props;
|
|
71
|
+
const currentTz = allTimezones.find(tz => tz.name === (value == null ? void 0 : value.timezone));
|
|
72
|
+
const userTz = allTimezones.find(tz => tz.name === Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
73
|
+
const handleTimezoneChange = selectedTz => {
|
|
74
|
+
var _a2, _b;
|
|
75
|
+
const newTimezone = (_a2 = allTimezones.find(tz => tz.value === selectedTz)) != null ? _a2 : userTz;
|
|
76
|
+
const offset = (_b = newTimezone.currentTimeOffsetInMinutes) != null ? _b : 0;
|
|
77
|
+
const timezonePatch = set(newTimezone.name, ["timezone"]);
|
|
78
|
+
const offsetPatch = set(offset, ["offset"]);
|
|
79
|
+
const patches = [timezonePatch, offsetPatch];
|
|
80
|
+
if (value == null ? void 0 : value.utc) {
|
|
81
|
+
const desiredDateTime = unlocalizeDateTime(value.utc, value.timezone);
|
|
82
|
+
const newUtcDate = zonedTimeToUtc(desiredDateTime, newTimezone.name).toISOString();
|
|
83
|
+
const newLocalDate = formatInTimeZone(newUtcDate, newTimezone.name, "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
84
|
+
patches.push(set(newUtcDate, ["utc"]));
|
|
85
|
+
patches.push(set(newLocalDate, ["local"]));
|
|
86
|
+
}
|
|
87
|
+
onChange(patches);
|
|
88
|
+
};
|
|
89
|
+
return (
|
|
90
|
+
//taken from Scheduled Publishing, again!
|
|
91
|
+
//https://github.com/sanity-io/sanity-plugin-scheduled-publishing/blob/bb282e3df9a8a73df37fab8ee1fdd0e2430745be/src/components/dialogs/DialogTimeZone.tsx#L100
|
|
92
|
+
/* @__PURE__ */
|
|
93
|
+
jsx(Box, {
|
|
94
|
+
padding: 4,
|
|
95
|
+
children: /* @__PURE__ */jsx(Autocomplete, {
|
|
96
|
+
fontSize: 2,
|
|
97
|
+
icon: SearchIcon,
|
|
98
|
+
id: "timezone",
|
|
99
|
+
onChange: handleTimezoneChange,
|
|
100
|
+
openButton: true,
|
|
101
|
+
options: allTimezones,
|
|
102
|
+
padding: 4,
|
|
103
|
+
placeholder: "Search for a city or time zone",
|
|
104
|
+
popover: {
|
|
105
|
+
boundaryElement: document.querySelector("body"),
|
|
106
|
+
constrainSize: true,
|
|
107
|
+
placement: "bottom-start"
|
|
108
|
+
},
|
|
109
|
+
renderOption: option => {
|
|
110
|
+
return /* @__PURE__ */jsx(Card, {
|
|
111
|
+
as: "button",
|
|
112
|
+
padding: 3,
|
|
113
|
+
children: /* @__PURE__ */jsxs(Text, {
|
|
114
|
+
size: 1,
|
|
115
|
+
textOverflow: "ellipsis",
|
|
116
|
+
children: [/* @__PURE__ */jsxs("span", {
|
|
117
|
+
children: ["GMT", option.offset]
|
|
118
|
+
}), /* @__PURE__ */jsx("span", {
|
|
119
|
+
style: {
|
|
120
|
+
fontWeight: 500,
|
|
121
|
+
marginLeft: "1em"
|
|
122
|
+
},
|
|
123
|
+
children: option.alternativeName
|
|
124
|
+
}), /* @__PURE__ */jsx("span", {
|
|
125
|
+
style: {
|
|
126
|
+
marginLeft: "1em"
|
|
127
|
+
},
|
|
128
|
+
children: option.mainCities
|
|
129
|
+
})]
|
|
130
|
+
})
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
renderValue: (_, option) => {
|
|
134
|
+
if (!option) return "";
|
|
135
|
+
return "".concat(option.alternativeName, " (").concat(option.namePretty, ")");
|
|
136
|
+
},
|
|
137
|
+
tabIndex: -1,
|
|
138
|
+
value: (_a = currentTz == null ? void 0 : currentTz.value) != null ? _a : userTz.value
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
const TimezoneButton = props => {
|
|
144
|
+
var _a, _b, _c;
|
|
145
|
+
const {
|
|
146
|
+
onClick,
|
|
147
|
+
timezone
|
|
148
|
+
} = props;
|
|
149
|
+
const currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
150
|
+
const label = (_c = (_a = allTimezones.find(tz => tz.name === timezone)) == null ? void 0 : _a.abbreviation) != null ? _c : (_b = allTimezones.find(tz => tz.name === currentTimezone)) == null ? void 0 : _b.abbreviation;
|
|
151
|
+
return /* @__PURE__ */jsx(Button, {
|
|
152
|
+
fontSize: 1,
|
|
153
|
+
style: {
|
|
154
|
+
width: "100%"
|
|
155
|
+
},
|
|
156
|
+
justify: "flex-start",
|
|
157
|
+
icon: EarthAmericasIcon,
|
|
158
|
+
mode: "ghost",
|
|
159
|
+
onClick,
|
|
160
|
+
text: "".concat(label),
|
|
161
|
+
"aria-label": "Select a timezone"
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
const RichDateInput = props => {
|
|
165
|
+
const {
|
|
166
|
+
onChange,
|
|
167
|
+
value,
|
|
168
|
+
members,
|
|
169
|
+
schemaType
|
|
170
|
+
} = props;
|
|
171
|
+
const {
|
|
172
|
+
options
|
|
173
|
+
} = schemaType;
|
|
174
|
+
const localMember = members.find(member => member.kind === "field" && member.name === "local");
|
|
175
|
+
const timezoneMember = members.find(member => member.kind === "field" && member.name === "timezone");
|
|
176
|
+
const [timezoneSelectorOpen, setTimezoneSelectorOpen] = useState(false);
|
|
177
|
+
const onClose = useCallback(() => setTimezoneSelectorOpen(false), []);
|
|
178
|
+
const onOpen = useCallback(() => setTimezoneSelectorOpen(true), []);
|
|
179
|
+
return /* @__PURE__ */jsxs(Fragment, {
|
|
180
|
+
children: [/* @__PURE__ */jsxs(Flex, {
|
|
181
|
+
children: [/* @__PURE__ */jsx(Box, {
|
|
182
|
+
flex: [1, 2, 4],
|
|
183
|
+
children: localMember && /* @__PURE__ */jsx(ObjectInputMember, {
|
|
184
|
+
...props,
|
|
185
|
+
member: localMember,
|
|
186
|
+
renderInput: renderInputProps => /* @__PURE__ */jsx(RelativeDateTimePicker, {
|
|
187
|
+
...renderInputProps,
|
|
188
|
+
dateValue: value,
|
|
189
|
+
schemaType: {
|
|
190
|
+
...renderInputProps.schemaType,
|
|
191
|
+
options
|
|
192
|
+
},
|
|
193
|
+
onChange
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
}), /* @__PURE__ */jsx(Box, {
|
|
197
|
+
flex: [1],
|
|
198
|
+
marginLeft: [2, 2, 3, 4],
|
|
199
|
+
children: timezoneMember && /* @__PURE__ */jsx(ObjectInputMember, {
|
|
200
|
+
...props,
|
|
201
|
+
member: timezoneMember,
|
|
202
|
+
renderInput: () => {
|
|
203
|
+
var _a;
|
|
204
|
+
return /* @__PURE__ */jsx(TimezoneButton, {
|
|
205
|
+
onClick: onOpen,
|
|
206
|
+
timezone: (_a = value == null ? void 0 : value.timezone) != null ? _a : ""
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
})]
|
|
211
|
+
}), timezoneSelectorOpen && /* @__PURE__ */jsx(Dialog, {
|
|
212
|
+
onClose,
|
|
213
|
+
header: "Select a timezone",
|
|
214
|
+
id: "timezone-select",
|
|
215
|
+
width: 1,
|
|
216
|
+
children: /* @__PURE__ */jsx(TimezoneSelector, {
|
|
217
|
+
onChange,
|
|
218
|
+
value
|
|
219
|
+
})
|
|
220
|
+
})]
|
|
221
|
+
});
|
|
222
|
+
};
|
|
223
|
+
const richDateTypeName = "richDate";
|
|
224
|
+
const richDateSchema = defineType({
|
|
225
|
+
name: richDateTypeName,
|
|
226
|
+
title: "Rich Date",
|
|
227
|
+
type: "object",
|
|
228
|
+
fields: [defineField({
|
|
229
|
+
name: "local",
|
|
230
|
+
title: "Local",
|
|
231
|
+
type: "string"
|
|
232
|
+
}), defineField({
|
|
233
|
+
name: "utc",
|
|
234
|
+
title: "UTC",
|
|
235
|
+
type: "string"
|
|
236
|
+
}), defineField({
|
|
237
|
+
name: "timezone",
|
|
238
|
+
title: "Timezone",
|
|
239
|
+
type: "string"
|
|
240
|
+
}), defineField({
|
|
241
|
+
name: "offset",
|
|
242
|
+
title: "Offset",
|
|
243
|
+
type: "number"
|
|
244
|
+
})],
|
|
245
|
+
components: {
|
|
246
|
+
input: RichDateInput
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
const richDate = definePlugin({
|
|
250
|
+
name: "v3-rich-date-input",
|
|
251
|
+
schema: {
|
|
252
|
+
types: [richDateSchema]
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
export { richDate };
|
|
256
|
+
//# sourceMappingURL=index.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/utils/index.ts","../src/components/RelativeDateTimePicker.tsx","../src/components/TimezoneSelector.tsx","../src/components/TimezoneButton.tsx","../src/components/RichDateInput.tsx","../src/schema.ts","../src/index.ts"],"sourcesContent":["import {getTimeZones} from '@vvo/tzdb'\nimport {NormalizedTimeZone} from '../types'\nimport {formatInTimeZone} from 'date-fns-tz'\n\nexport const unlocalizeDateTime = (datetime: string, timezone: string): string => {\n return formatInTimeZone(datetime, timezone, 'yyyy-MM-dd HH:mm:ss')\n}\n\n/* We have to \"fake\" a UTC date to make the datepicker look \"right\"\n * to the user. For example, if someone sets 7:00AM PST, which is 3PM UTC\n * and I am on the east coast, I want to have 12:00PM UTC, which will look like 7:00AM to me\n * In other words, UTC minus 3 hours, or (UTC(my offset - their offset))\n * this is purely cosmetic and should not be saved at all\n */\nexport const getConstructedUTCDate = (utc: string, offset: number): string => {\n const date = new Date(utc)\n const currentOffset = new Date().getTimezoneOffset() * -1\n const diff = currentOffset - offset\n const fakeUTCDate = new Date(date.getTime() - diff * 60 * 1000)\n return fakeUTCDate.toISOString()\n}\n\n//keep some consistency with scheduled publishing\n//https://github.com/sanity-io/sanity-plugin-scheduled-publishing/blob/bb282e3df9a8a73df37fab8ee1fdd0e2430745be/src/hooks/useTimeZone.tsx#L17\nexport const allTimezones = getTimeZones().map((tz) => {\n return {\n abbreviation: tz.abbreviation,\n alternativeName: tz.alternativeName,\n mainCities: tz.mainCities.join(', '),\n // Main time zone name 'Africa/Dar_es_Salaam'\n name: tz.name,\n // Time zone name with underscores removed\n namePretty: tz.name.replaceAll('_', ' '),\n offset: tz.currentTimeFormat.split(' ')[0],\n // all searchable text - this is transformed before being rendered in `<AutoComplete>`\n value: `${tz.currentTimeFormat} ${tz.abbreviation} ${tz.name}`,\n currentTimeOffsetInMinutes: tz.currentTimeOffsetInMinutes,\n } as NormalizedTimeZone\n})\n","import {DateTimeInput, FormPatch, PatchEvent, InputProps, set, unset} from 'sanity'\n\nimport {getConstructedUTCDate, unlocalizeDateTime} from '../utils'\nimport {RichDate} from '../types'\nimport {formatInTimeZone, zonedTimeToUtc} from 'date-fns-tz'\n\ninterface RelativeDateTimePickerProps extends Omit<InputProps, 'renderDefault'> {\n dateValue?: RichDate\n}\n\nexport const RelativeDateTimePicker = (props: RelativeDateTimePickerProps) => {\n const value = props.dateValue\n const timezone = value?.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone\n /*\n * if our offset is not coming from a lib, we have to reverse it\n * to get the real offset used everywhere\n * https://momentjscom.readthedocs.io/en/latest/moment/03-manipulating/09-utc-offset/\n */\n const offset = value?.offset ?? new Date().getTimezoneOffset() * -1\n const handleDateChange = (patch: FormPatch | PatchEvent | FormPatch[]) => {\n const patches = []\n const newDatetime = (patch as unknown as {value: string})?.value\n if (!newDatetime || !('type' in patch) || patch.type !== 'set') {\n props.onChange(unset())\n return\n }\n\n //get what time the user \"meant\" to set without tz info\n //since the datepicker always localizes to the user's timezone\n const desiredDateTime = unlocalizeDateTime(\n newDatetime,\n Intl.DateTimeFormat().resolvedOptions().timeZone,\n )\n\n //use the user-selected timezone here\n const utcDate = zonedTimeToUtc(desiredDateTime, timezone).toISOString()\n const localDate = formatInTimeZone(utcDate, timezone, \"yyyy-MM-dd'T'HH:mm:ssXXX\")\n\n patches.push(set(utcDate, ['utc']))\n patches.push(set(localDate, ['local']))\n\n if (!value?.timezone) {\n patches.push(set(timezone, ['timezone']))\n }\n\n if (!value?.offset) {\n patches.push(set(offset, ['offset']))\n }\n\n props.onChange(patches)\n }\n\n const dateToDisplay = value?.utc ? getConstructedUTCDate(value.utc, value.offset) : ''\n //@ts-expect-error -- slight mismatch in elementProps and renderDefault, but should line up in practice\n return <DateTimeInput {...props} onChange={handleDateChange} value={dateToDisplay} />\n}\n","import {SearchIcon} from '@sanity/icons'\nimport {ObjectInputProps, set} from 'sanity'\nimport {allTimezones, unlocalizeDateTime} from '../utils'\nimport {NormalizedTimeZone, RichDate} from '../types'\nimport {Autocomplete, Card, Text, Box} from '@sanity/ui'\nimport {formatInTimeZone, zonedTimeToUtc} from 'date-fns-tz'\n\ninterface TimezoneSelectorProps {\n onChange: Pick<ObjectInputProps, 'onChange'>['onChange']\n value?: RichDate\n}\n\nexport const TimezoneSelector = (props: TimezoneSelectorProps) => {\n const {onChange, value} = props\n const currentTz = allTimezones.find((tz) => tz.name === value?.timezone)\n const userTz = allTimezones.find(\n (tz) => tz.name === Intl.DateTimeFormat().resolvedOptions().timeZone,\n )!\n\n const handleTimezoneChange = (selectedTz: string) => {\n const newTimezone =\n allTimezones.find((tz) => tz.value === selectedTz) ?? (userTz as NormalizedTimeZone)\n\n const offset = newTimezone.currentTimeOffsetInMinutes ?? 0\n const timezonePatch = set(newTimezone.name, ['timezone'])\n const offsetPatch = set(offset, ['offset'])\n const patches = [timezonePatch, offsetPatch]\n\n //then, recalculate UTC and local from \"old\" time with the new offset\n if (value?.utc) {\n const desiredDateTime = unlocalizeDateTime(value.utc, value.timezone)\n const newUtcDate = zonedTimeToUtc(desiredDateTime, newTimezone.name).toISOString()\n const newLocalDate = formatInTimeZone(\n newUtcDate,\n newTimezone.name,\n \"yyyy-MM-dd'T'HH:mm:ssXXX\",\n )\n patches.push(set(newUtcDate, ['utc']))\n patches.push(set(newLocalDate, ['local']))\n }\n onChange(patches)\n }\n\n return (\n //taken from Scheduled Publishing, again!\n //https://github.com/sanity-io/sanity-plugin-scheduled-publishing/blob/bb282e3df9a8a73df37fab8ee1fdd0e2430745be/src/components/dialogs/DialogTimeZone.tsx#L100\n <Box padding={4}>\n <Autocomplete\n fontSize={2}\n icon={SearchIcon}\n id=\"timezone\"\n onChange={handleTimezoneChange}\n openButton\n options={allTimezones}\n padding={4}\n placeholder=\"Search for a city or time zone\"\n popover={{\n boundaryElement: document.querySelector('body'),\n constrainSize: true,\n placement: 'bottom-start',\n }}\n renderOption={(option) => {\n return (\n <Card as=\"button\" padding={3}>\n <Text size={1} textOverflow=\"ellipsis\">\n <span>GMT{option.offset}</span>\n <span style={{fontWeight: 500, marginLeft: '1em'}}>{option.alternativeName}</span>\n <span style={{marginLeft: '1em'}}>{option.mainCities}</span>\n </Text>\n </Card>\n )\n }}\n renderValue={(_, option) => {\n if (!option) return ''\n return `${option.alternativeName} (${option.namePretty})`\n }}\n tabIndex={-1}\n value={currentTz?.value ?? userTz.value}\n />\n </Box>\n )\n}\n","import {Button} from '@sanity/ui'\nimport {EarthAmericasIcon} from '@sanity/icons'\nimport {allTimezones} from '../utils'\nimport {NormalizedTimeZone} from '../types'\n\ninterface TimezoneButtonProps {\n onClick: () => void\n timezone: string\n}\n\nexport const TimezoneButton = (props: TimezoneButtonProps) => {\n const {onClick, timezone} = props\n const currentTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone\n const label =\n allTimezones.find((tz: NormalizedTimeZone) => tz.name === timezone)?.abbreviation ??\n allTimezones.find((tz: NormalizedTimeZone) => tz.name === currentTimezone)?.abbreviation\n\n return (\n <Button\n fontSize={1}\n style={{width: '100%'}}\n justify={'flex-start'}\n icon={EarthAmericasIcon}\n mode=\"ghost\"\n onClick={onClick}\n text={`${label}`}\n aria-label=\"Select a timezone\"\n />\n )\n}\n","import {ObjectInputMember, ObjectInputProps} from 'sanity'\nimport {Box, Flex, Dialog} from '@sanity/ui'\nimport {RelativeDateTimePicker} from './RelativeDateTimePicker'\nimport {TimezoneSelector} from './TimezoneSelector'\nimport {useCallback, useState} from 'react'\nimport {TimezoneButton} from './TimezoneButton'\nimport {RichDate} from '../types'\n\nexport const RichDateInput = (props: ObjectInputProps) => {\n const {onChange, value, members, schemaType} = props\n const {options} = schemaType\n const localMember = members.find((member) => member.kind === 'field' && member.name === 'local')\n const timezoneMember = members.find(\n (member) => member.kind === 'field' && member.name === 'timezone',\n )\n const [timezoneSelectorOpen, setTimezoneSelectorOpen] = useState(false)\n const onClose = useCallback(() => setTimezoneSelectorOpen(false), [])\n const onOpen = useCallback(() => setTimezoneSelectorOpen(true), [])\n\n return (\n <>\n <Flex>\n <Box flex={[1, 2, 4]}>\n {localMember && (\n <ObjectInputMember\n {...props}\n member={localMember}\n renderInput={(renderInputProps) => (\n <RelativeDateTimePicker\n {...renderInputProps}\n dateValue={value as RichDate}\n schemaType={{...renderInputProps.schemaType, options}}\n onChange={onChange}\n />\n )}\n />\n )}\n </Box>\n <Box flex={[1]} marginLeft={[2, 2, 3, 4]}>\n {timezoneMember && (\n <ObjectInputMember\n {...props}\n member={timezoneMember}\n renderInput={() => (\n <TimezoneButton onClick={onOpen} timezone={value?.timezone ?? ''} />\n )}\n />\n )}\n </Box>\n </Flex>\n {timezoneSelectorOpen && (\n <Dialog onClose={onClose} header=\"Select a timezone\" id=\"timezone-select\" width={1}>\n <TimezoneSelector onChange={onChange} value={value as RichDate} />\n </Dialog>\n )}\n </>\n )\n}\n","import {\n DatetimeDefinition,\n ObjectDefinition,\n ObjectSchemaType,\n defineField,\n defineType,\n} from 'sanity'\nimport {RichDateInput} from './components/RichDateInput'\n\nconst richDateTypeName = 'richDate' as const\n\nexport type RichDateSchemaType = Omit<ObjectSchemaType, 'options'> & {\n options?: DatetimeDefinition['options']\n}\n\n/**\n * @public\n */\nexport interface RichDateDefinition extends Omit<ObjectDefinition, 'type' | 'fields' | 'options'> {\n type: typeof richDateTypeName\n options?: DatetimeDefinition['options']\n}\n\ndeclare module 'sanity' {\n //allows the custom input to be valid for the schema def\n export interface IntrinsicDefinitions {\n richDate: RichDateDefinition\n }\n}\n\nexport const richDateSchema = defineType({\n name: richDateTypeName,\n title: 'Rich Date',\n type: 'object',\n fields: [\n defineField({\n name: 'local',\n title: 'Local',\n type: 'string',\n }),\n defineField({\n name: 'utc',\n title: 'UTC',\n type: 'string',\n }),\n defineField({\n name: 'timezone',\n title: 'Timezone',\n type: 'string',\n }),\n defineField({\n name: 'offset',\n title: 'Offset',\n type: 'number',\n }),\n ],\n\n components: {\n input: RichDateInput,\n },\n})\n","import {definePlugin} from 'sanity'\nimport {richDateSchema, RichDateDefinition, RichDateSchemaType} from './schema'\nimport {RichDate} from './types'\n\nexport const richDate = definePlugin({\n name: 'v3-rich-date-input',\n schema: {\n types: [richDateSchema],\n },\n})\n\nexport type {RichDateDefinition, RichDateSchemaType, RichDate}\n"],"names":["unlocalizeDateTime","datetime","timezone","formatInTimeZone","getConstructedUTCDate","utc","offset","date","Date","currentOffset","getTimezoneOffset","diff","fakeUTCDate","getTime","toISOString","allTimezones","getTimeZones","map","tz","abbreviation","alternativeName","mainCities","join","name","namePretty","replaceAll","currentTimeFormat","split","value","concat","currentTimeOffsetInMinutes","RelativeDateTimePicker","props","_a","_b","dateValue","Intl","DateTimeFormat","resolvedOptions","timeZone","handleDateChange","patch","patches","newDatetime","type","onChange","unset","desiredDateTime","utcDate","zonedTimeToUtc","localDate","push","set","dateToDisplay","DateTimeInput","TimezoneSelector","currentTz","find","userTz","handleTimezoneChange","selectedTz","newTimezone","timezonePatch","offsetPatch","newUtcDate","newLocalDate","jsx","Box","padding","children","Autocomplete","fontSize","icon","SearchIcon","id","openButton","options","placeholder","popover","boundaryElement","document","querySelector","constrainSize","placement","renderOption","option","Card","as","jsxs","Text","size","textOverflow","style","fontWeight","marginLeft","renderValue","_","tabIndex","TimezoneButton","_c","onClick","currentTimezone","label","Button","width","justify","EarthAmericasIcon","mode","text","RichDateInput","members","schemaType","localMember","member","kind","timezoneMember","timezoneSelectorOpen","setTimezoneSelectorOpen","useState","onClose","useCallback","onOpen","Fragment","Flex","flex","ObjectInputMember","renderInput","renderInputProps","Dialog","header","richDateTypeName","richDateSchema","defineType","title","fields","defineField","components","input","richDate","definePlugin","schema","types"],"mappings":";;;;;;;AAIa,MAAAA,kBAAA,GAAqBA,CAACC,QAAA,EAAkBC,QAA6B,KAAA;EACzE,OAAAC,gBAAA,CAAiBF,QAAU,EAAAC,QAAA,EAAU,qBAAqB,CAAA;AACnE,CAAA;AAQa,MAAAE,qBAAA,GAAwBA,CAACC,GAAA,EAAaC,MAA2B,KAAA;EACtE,MAAAC,IAAA,GAAO,IAAIC,IAAA,CAAKH,GAAG,CAAA;EACzB,MAAMI,aAAgB,GAAA,eAAA,IAAID,IAAK,CAAA,CAAA,CAAEE,mBAAsB,GAAA,CAAA,CAAA;EACvD,MAAMC,OAAOF,aAAgB,GAAAH,MAAA;EACvB,MAAAM,WAAA,GAAc,IAAIJ,IAAK,CAAAD,IAAA,CAAKM,SAAY,GAAAF,IAAA,GAAO,KAAK,GAAI,CAAA;EAC9D,OAAOC,YAAYE,WAAY,EAAA;AACjC,CAAA;AAIO,MAAMC,YAAe,GAAAC,YAAA,CAAA,CAAe,CAAAC,GAAA,CAAKC,EAAO,IAAA;EAC9C,OAAA;IACLC,cAAcD,EAAG,CAAAC,YAAA;IACjBC,iBAAiBF,EAAG,CAAAE,eAAA;IACpBC,UAAY,EAAAH,EAAA,CAAGG,UAAW,CAAAC,IAAA,CAAK,IAAI,CAAA;IAAA;IAEnCC,MAAML,EAAG,CAAAK,IAAA;IAAA;IAETC,UAAY,EAAAN,EAAA,CAAGK,IAAK,CAAAE,UAAA,CAAW,KAAK,GAAG,CAAA;IACvCnB,QAAQY,EAAG,CAAAQ,iBAAA,CAAkBC,KAAM,CAAA,GAAG,EAAE,CAAC,CAAA;IAAA;IAE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