sanity-plugin-recurring-dates 1.4.0 → 1.4.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-recurring-dates",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Add a custom input component to your Sanity Studio to manage recurring dates (e.g. for events)",
5
5
  "keywords": [
6
6
  "sanity",
@@ -126,7 +126,7 @@ export function CustomRule({
126
126
  interval,
127
127
  count: count || null,
128
128
  until: until ? (until as Date) : null,
129
- byweekday,
129
+ byweekday: frequency === RRule.WEEKLY || frequency === RRule.MONTHLY ? byweekday : null,
130
130
  }
131
131
 
132
132
  const newRule = new RRule(newOptions)
@@ -1,5 +1,5 @@
1
1
  import {Box, Flex, Select, Text} from '@sanity/ui'
2
- import React, {useCallback} from 'react'
2
+ import React, {useCallback, useEffect} from 'react'
3
3
  import {Options, Weekday} from 'rrule'
4
4
 
5
5
  import {DAYS} from '../../constants'
@@ -34,6 +34,12 @@ export function Monthly(props: MonthlyProps): React.JSX.Element {
34
34
  [dayNo, setByweekday, weekNo],
35
35
  )
36
36
 
37
+ useEffect(() => {
38
+ if (!weekNo) {
39
+ setByweekday(null)
40
+ }
41
+ }, [])
42
+
37
43
  return (
38
44
  <Flex gap={2} align="center">
39
45
  <Text style={{whiteSpace: 'nowrap'}}>On the</Text>