mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
New: UI Updates, Tag manager, More custom filters (#437)
* New: UI Updates, Tag manager, More custom filters * fixup! Fix ScanFixture Unit Tests * Fixed: Sentry Errors from UI don't have release, branch, environment * Changed: Bump Mobile Detect for New Device Detection * Fixed: Build on changes to package.json * fixup! Add MetadataProfile filter option * fixup! Tag Note, Blacklist, Manual Import * fixup: Remove connectSection * fixup: root folder comment
This commit is contained in:
33
frontend/src/Utilities/Date/dateFilterPredicate.js
Normal file
33
frontend/src/Utilities/Date/dateFilterPredicate.js
Normal file
@@ -0,0 +1,33 @@
|
||||
import moment from 'moment';
|
||||
import isAfter from 'Utilities/Date/isAfter';
|
||||
import isBefore from 'Utilities/Date/isBefore';
|
||||
import * as filterTypes from 'Helpers/Props/filterTypes';
|
||||
|
||||
export default function(itemValue, filterValue, type) {
|
||||
if (!itemValue) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case filterTypes.LESS_THAN:
|
||||
return moment(itemValue).isBefore(filterValue);
|
||||
|
||||
case filterTypes.GREATER_THAN:
|
||||
return moment(itemValue).isAfter(filterValue);
|
||||
|
||||
case filterTypes.IN_LAST:
|
||||
return (
|
||||
isAfter(itemValue, { [filterValue.time]: filterValue.value * -1 }) &&
|
||||
isBefore(itemValue)
|
||||
);
|
||||
|
||||
case filterTypes.IN_NEXT:
|
||||
return (
|
||||
isAfter(itemValue) &&
|
||||
isBefore(itemValue, { [filterValue.time]: filterValue.value })
|
||||
);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
3
frontend/src/Utilities/String/isString.js
Normal file
3
frontend/src/Utilities/String/isString.js
Normal file
@@ -0,0 +1,3 @@
|
||||
export default function isString(possibleString) {
|
||||
return typeof possibleString === 'string' || possibleString instanceof String;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ function titleCase(input) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return input.replace(/\w\S*/g, (match) => {
|
||||
return input.replace(/\b\w+/g, (match) => {
|
||||
return match.charAt(0).toUpperCase() + match.substr(1).toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user