@internetarchive/collection-browser 4.5.0 → 4.5.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/dist/src/collection-browser.d.ts +0 -4
- package/dist/src/collection-browser.js +1 -10
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +5 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +8 -6
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/restoration-state-handler.js +2 -4
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/utils/date-filter-field.d.ts +6 -0
- package/dist/src/utils/date-filter-field.js +9 -0
- package/dist/src/utils/date-filter-field.js.map +1 -0
- package/dist/test/collection-browser.test.js +273 -192
- package/dist/test/collection-browser.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +1 -12
- package/src/data-source/collection-browser-data-source-interface.ts +351 -345
- package/src/data-source/collection-browser-data-source.ts +1474 -1465
- package/src/restoration-state-handler.ts +550 -550
- package/src/utils/date-filter-field.ts +11 -0
- package/test/collection-browser.test.ts +2639 -2507
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines the appropriate search filter field name based on date format.
|
|
3
|
+
* Dates in YYYY-MM format (containing a hyphen) use the `date` field;
|
|
4
|
+
* dates in YYYY format use the `year` field.
|
|
5
|
+
*/
|
|
6
|
+
export function dateFilterField(
|
|
7
|
+
minDate?: string,
|
|
8
|
+
maxDate?: string,
|
|
9
|
+
): 'date' | 'year' {
|
|
10
|
+
return minDate?.includes('-') || maxDate?.includes('-') ? 'date' : 'year';
|
|
11
|
+
}
|