mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 14:14:19 +00:00
Allow datetime object for filtering date values
This commit is contained in:
parent
da5699cd0d
commit
cbdda0b80e
1 changed files with 5 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
from datetime import datetime
|
||||
from urllib.parse import quote, quote_plus, urlencode
|
||||
|
||||
from plexapi import X_PLEX_CONTAINER_SIZE, log, media, utils
|
||||
|
@ -810,7 +811,10 @@ class LibrarySection(PlexObject):
|
|||
if fieldType.type == 'boolean':
|
||||
value = int(utils.cast(bool, value))
|
||||
elif fieldType.type == 'date':
|
||||
value = int(utils.toDatetime(value, '%Y-%m-%d').timestamp())
|
||||
if isinstance(value, datetime):
|
||||
value = int(value.timestamp())
|
||||
else:
|
||||
value = int(utils.toDatetime(value, '%Y-%m-%d').timestamp())
|
||||
elif fieldType.type == 'integer':
|
||||
value = utils.cast(int, value)
|
||||
elif fieldType.type == 'string':
|
||||
|
|
Loading…
Reference in a new issue