diff --git a/core/models/media_model.php b/core/models/media_model.php
index ad873823..e8112a76 100644
--- a/core/models/media_model.php
+++ b/core/models/media_model.php
@@ -954,7 +954,7 @@ public function search_filters_validate($args = [])
OBFHelpers::require_args($args, ['filters']);
$filters = $args['filters'];
- $allowed_filters = ['comments','artist','title','album','year','type','category','country','language','genre','duration','is_copyright_owner','status','dynamic_select'];
+ $allowed_filters = ['comments','artist','title','album','year','type','category','country','language','genre','duration','created','updated','is_copyright_owner','status','dynamic_select'];
$allowed_operators = [
// deprecated
'like',
@@ -1034,6 +1034,8 @@ public function search_filters_where_array($args = [])
$column_array['language'] = 'media.language';
$column_array['genre'] = 'media.genre_id';
$column_array['duration'] = 'media.duration';
+ $column_array['created'] = 'media.created';
+ $column_array['updated'] = 'media.updated';
$column_array['comments'] = 'media.comments';
$column_array['is_copyright_owner'] = 'media.is_copyright_owner';
$column_array['dynamic_select'] = 'media.dynamic_select';
@@ -1110,6 +1112,37 @@ public function search_filters_where_array($args = [])
$tmp_sql = $column_array[$filter['filter']];
}
+ $is_date_filter = in_array($filter['filter'], ['created', 'updated'], true);
+ $date_value = null;
+ if ($is_date_filter && preg_match('/^\d{4}-\d{2}-\d{2}$/', (string) $filter['val'])) {
+ $date_value = strtotime($filter['val'] . ' 00:00:00');
+ }
+
+ if ($is_date_filter && $date_value !== false && $date_value !== null) {
+ $day_start = (int) $date_value;
+ $day_end = $day_start + 86399;
+ $column = $tmp_sql;
+
+ if (in_array($filter['op'], ['is', 'eq'], true)) {
+ $tmp_sql = '(' . $column . ' >= "' . $day_start . '" AND ' . $column . ' <= "' . $day_end . '")';
+ } elseif (in_array($filter['op'], ['not', 'neq'], true)) {
+ $tmp_sql = '(' . $column . ' < "' . $day_start . '" OR ' . $column . ' > "' . $day_end . '")';
+ } elseif (in_array($filter['op'], ['gte', 'gt'], true)) {
+ $compare_value = $filter['op'] == 'gt' ? $day_end : $day_start;
+ $operator = $filter['op'] == 'gt' ? '>' : '>=';
+ $tmp_sql = $column . ' ' . $operator . ' "' . $compare_value . '"';
+ } elseif (in_array($filter['op'], ['lte', 'lt'], true)) {
+ $compare_value = $filter['op'] == 'lt' ? $day_start : $day_end;
+ $operator = $filter['op'] == 'lt' ? '<' : '<=';
+ $tmp_sql = $column . ' ' . $operator . ' "' . $compare_value . '"';
+ } else {
+ $tmp_sql = $column . ' ' . $op_array[$filter['op']] . ' "' . $day_start . '"';
+ }
+
+ $where_array[] = $tmp_sql;
+ continue;
+ }
+
$tmp_sql .= ' ' . $op_array[$filter['op']] . ' "';
// TODO like, not_like deprecated
diff --git a/public/html/sidebar/advanced_search.html b/public/html/sidebar/advanced_search.html
index cffcba45..f3f5dfd9 100644
--- a/public/html/sidebar/advanced_search.html
+++ b/public/html/sidebar/advanced_search.html
@@ -18,6 +18,8 @@
+
+
@@ -49,6 +51,13 @@
+
+
+