cattle-care-ui 0.2.0 → 0.3.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.
@@ -0,0 +1,31 @@
1
+ /** A range being picked. `end` is null until the second click. Days are local midnight. */
2
+ export interface DateRange {
3
+ start: Date | null;
4
+ end: Date | null;
5
+ }
6
+ export interface CompleteRange {
7
+ start: Date;
8
+ end: Date;
9
+ }
10
+ export declare function isComplete(range: DateRange): range is CompleteRange;
11
+ /**
12
+ * One calendar click. With no start yet (or a finished range) the day becomes a new start;
13
+ * while picking the end, a day before the start becomes the new start instead.
14
+ */
15
+ export declare function pickRangeDay(draft: DateRange, day: Date): DateRange;
16
+ /** What the calendar shows: while picking the end, the hovered day previews the range (either direction). */
17
+ export declare function previewRange(draft: DateRange, hover: Date | null): DateRange;
18
+ export interface FormatRangeOptions {
19
+ locale: string;
20
+ /** Used to decide whether the year can be left out. */
21
+ today?: Date;
22
+ /** Replaces the built-in day format (and the year logic) entirely. */
23
+ formatValue?: (date: Date) => string;
24
+ }
25
+ /** Regular spaces around an en dash: "Oct 26 – Nov 01". */
26
+ export declare const RANGE_SEPARATOR = " \u2013 ";
27
+ /**
28
+ * "Oct 24 – Oct 31". Years appear (on both ends) only when a date is outside the current year.
29
+ * A one-day range reads as a single date.
30
+ */
31
+ export declare function formatRange(range: DateRange, { locale, today, formatValue }: FormatRangeOptions): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cattle-care-ui",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",