diff --git a/material/plugins/blog/structure/options.py b/material/plugins/blog/structure/options.py index 409274472..a7bab08fe 100644 --- a/material/plugins/blog/structure/options.py +++ b/material/plugins/blog/structure/options.py @@ -18,7 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from datetime import date, datetime, time +from datetime import date, datetime, time, timezone from mkdocs.config.base import BaseConfigOption, Config, ValidationError from typing import Dict @@ -69,9 +69,9 @@ class PostDate(BaseConfigOption[DateDict]): continue # Handle date - we set 00:00:00 as the default time, if the author - # only supplied a date, and convert it to datetime + # only supplied a date, and convert it to datetime in UTC if isinstance(value, date): - config[key_name][key] = datetime.combine(value, time()) + config[key_name][key] = datetime.combine(value, time()).replace(tzinfo=timezone.utc) # Initialize date dictionary config[key_name] = DateDict(config[key_name]) diff --git a/src/plugins/blog/structure/options.py b/src/plugins/blog/structure/options.py index 409274472..a7bab08fe 100644 --- a/src/plugins/blog/structure/options.py +++ b/src/plugins/blog/structure/options.py @@ -18,7 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -from datetime import date, datetime, time +from datetime import date, datetime, time, timezone from mkdocs.config.base import BaseConfigOption, Config, ValidationError from typing import Dict @@ -69,9 +69,9 @@ class PostDate(BaseConfigOption[DateDict]): continue # Handle date - we set 00:00:00 as the default time, if the author - # only supplied a date, and convert it to datetime + # only supplied a date, and convert it to datetime in UTC if isinstance(value, date): - config[key_name][key] = datetime.combine(value, time()) + config[key_name][key] = datetime.combine(value, time()).replace(tzinfo=timezone.utc) # Initialize date dictionary config[key_name] = DateDict(config[key_name])