sanity-plugin-recurring-dates 1.3.1 → 1.3.2
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Box, Flex, Grid, Select, Stack, Text} from '@sanity/ui'
|
|
2
2
|
import {upperFirst} from 'lodash'
|
|
3
3
|
import React, {useCallback, useState} from 'react'
|
|
4
|
-
import {rrulestr} from 'rrule'
|
|
4
|
+
import {datetime, rrulestr} from 'rrule'
|
|
5
5
|
import {
|
|
6
6
|
ObjectInputMember,
|
|
7
7
|
type ObjectInputProps,
|
|
@@ -157,6 +157,17 @@ export function RecurringDates(props: RecurringDatesProps): React.JSX.Element {
|
|
|
157
157
|
}
|
|
158
158
|
const rule = rrulestr(recurrence)
|
|
159
159
|
|
|
160
|
+
rule.options.until =
|
|
161
|
+
rule?.options?.until &&
|
|
162
|
+
datetime(
|
|
163
|
+
rule?.options?.until?.getFullYear(),
|
|
164
|
+
rule?.options?.until?.getMonth() + 1,
|
|
165
|
+
rule?.options?.until?.getDate(),
|
|
166
|
+
rule?.options?.until?.getHours(),
|
|
167
|
+
rule?.options?.until?.getMinutes(),
|
|
168
|
+
rule?.options?.until?.getSeconds(),
|
|
169
|
+
)
|
|
170
|
+
|
|
160
171
|
return (
|
|
161
172
|
<option key={recurrence} value={recurrence}>
|
|
162
173
|
{upperFirst(rule.toText())}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {DEFAULT_DATE_FORMAT, DEFAULT_TIME_FORMAT, format} from '@sanity/util/legacyDateFormat'
|
|
2
2
|
import {upperFirst} from 'lodash'
|
|
3
3
|
import React from 'react'
|
|
4
|
-
import {rrulestr} from 'rrule'
|
|
4
|
+
import {datetime, rrulestr} from 'rrule'
|
|
5
5
|
import type {ObjectSchemaType, PreviewProps} from 'sanity'
|
|
6
6
|
|
|
7
7
|
import type {PluginConfig, RecurringDate, WithRequiredProperty} from '../types'
|
|
@@ -26,6 +26,19 @@ export function RecurringDatesPreview(props: CastPreviewProps): React.JSX.Elemen
|
|
|
26
26
|
|
|
27
27
|
const rule = rrule && rrulestr(rrule)
|
|
28
28
|
|
|
29
|
+
if (rule) {
|
|
30
|
+
rule.options.until =
|
|
31
|
+
rule?.options?.until &&
|
|
32
|
+
datetime(
|
|
33
|
+
rule?.options?.until?.getFullYear(),
|
|
34
|
+
rule?.options?.until?.getMonth() + 1,
|
|
35
|
+
rule?.options?.until?.getDate(),
|
|
36
|
+
rule?.options?.until?.getHours(),
|
|
37
|
+
rule?.options?.until?.getMinutes(),
|
|
38
|
+
rule?.options?.until?.getSeconds(),
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
const dateFormat = dateTimeOptions?.dateFormat || DEFAULT_DATE_FORMAT
|
|
30
43
|
const timeFormat = dateTimeOptions?.timeFormat || DEFAULT_TIME_FORMAT
|
|
31
44
|
|