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/dist/index.esm.js CHANGED
@@ -5,7 +5,7 @@ import { Card, Text, Box, Grid, TextInput, useForwardedRef, Flex, Select, Button
5
5
  import { range, upperFirst } from 'lodash';
6
6
  import * as React from 'react';
7
7
  import React__default, { useState, useEffect, PureComponent, useCallback, forwardRef, useRef, useMemo } from 'react';
8
- import { rrulestr, Weekday, RRule } from 'rrule';
8
+ import { rrulestr, Weekday, RRule, datetime } from 'rrule';
9
9
  import { Feedback } from 'sanity-plugin-utils';
10
10
  import { toDate as toDate$1, format as format$1 } from 'date-fns-tz';
11
11
  import { format, parse, DEFAULT_DATE_FORMAT as DEFAULT_DATE_FORMAT$1, DEFAULT_TIME_FORMAT } from '@sanity/util/legacyDateFormat';
@@ -4778,6 +4778,7 @@ function RecurringDates(props) {
4778
4778
  return null;
4779
4779
  }
4780
4780
  const rule = rrulestr(recurrence);
4781
+ rule.options.until = rule?.options?.until && datetime(rule?.options?.until?.getFullYear(), rule?.options?.until?.getMonth() + 1, rule?.options?.until?.getDate(), rule?.options?.until?.getHours(), rule?.options?.until?.getMinutes(), rule?.options?.until?.getSeconds());
4781
4782
  return /* @__PURE__ */jsx("option", {
4782
4783
  value: recurrence,
4783
4784
  children: upperFirst(rule.toText())
@@ -4816,6 +4817,9 @@ function RecurringDatesPreview(props) {
4816
4817
  ...options
4817
4818
  };
4818
4819
  const rule = rrule && rrulestr(rrule);
4820
+ if (rule) {
4821
+ rule.options.until = rule?.options?.until && datetime(rule?.options?.until?.getFullYear(), rule?.options?.until?.getMonth() + 1, rule?.options?.until?.getDate(), rule?.options?.until?.getHours(), rule?.options?.until?.getMinutes(), rule?.options?.until?.getSeconds());
4822
+ }
4819
4823
  const dateFormat = dateTimeOptions?.dateFormat || DEFAULT_DATE_FORMAT$1;
4820
4824
  const timeFormat = dateTimeOptions?.timeFormat || DEFAULT_TIME_FORMAT;
4821
4825
  const start = startDate ? new Date(startDate) : void 0;