sanity-plugin-recurring-dates 1.0.3 → 1.1.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 Tom Smith
3
+ Copyright (c) 2024 Tom Smith
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -68,6 +68,9 @@ export default defineConfig({
68
68
  timeFormat: 'HH:mm',
69
69
  timeStep: 15,
70
70
  },
71
+
72
+ // Changes the date picker to date only, no time
73
+ dateOnly: true, // defaults to false
71
74
  }),
72
75
  ],
73
76
  })
@@ -102,6 +105,9 @@ defineField({
102
105
  timeFormat: 'HH:mm',
103
106
  timeStep: 15,
104
107
  },
108
+
109
+ // Changes the date picker to date only, no time
110
+ dateOnly: true, // defaults to false
105
111
  },
106
112
  })
107
113
  ```
@@ -120,6 +126,18 @@ Here is an example of the data stored on the field after configuring a recurring
120
126
 
121
127
  As the plugin uses the standard Sanity `datetime` field type, the start and end dates are stored in UTC. The `rrule` string is in line with the recurrence rules defined in the [iCalendar RFC](https://tools.ietf.org/html/rfc5545), with rules generated by the [rrule.js](https://github.com/jakubroztocil/rrule) library.
122
128
 
129
+ If you enable the `dateOnly` option, then the time will not be present on the field:
130
+
131
+ ```json
132
+ {
133
+ "rrule": "RRULE:FREQ=MONTHLY;INTERVAL=1;BYDAY=+1MO",
134
+ "startDate": "2023-08-01",
135
+ "endDate": "2023-08-01"
136
+ }
137
+ ```
138
+
139
+ Depending on how you use the data, you may need to append a time to the date before using it on your front-end.
140
+
123
141
  ### Using the rules on a frontend
124
142
 
125
143
  Whilst displaying the recurring dates on a frontend is beyond the scope of this plugin, there are a couple of considerations worth calling out.
package/dist/index.d.ts CHANGED
@@ -7,12 +7,13 @@ export declare interface PluginConfig {
7
7
  hideEndDate?: boolean
8
8
  hideCustom?: boolean
9
9
  dateTimeOptions?: DatetimeOptions
10
+ dateOnly?: boolean
10
11
  }
11
12
 
12
13
  export declare interface RecurringDate {
13
14
  rrule: string
14
15
  startDate: string
15
- endDate: String
16
+ endDate: string
16
17
  }
17
18
 
18
19
  export declare type RecurringDateFieldOptions = Omit<ObjectDefinition, 'type' | 'fields'> & {