From bc0253d762a2fdde669bbf1feffa9970884882a5 Mon Sep 17 00:00:00 2001 From: Kenji Ishii Date: Mon, 29 Feb 2016 16:43:35 +0900 Subject: [PATCH] Fix an error which cause on Feb 29 in user setting In Feb 29(leap year), when users update user settings, error will occur. Settings expiration is a year later and this calculation is incorrect. This patch will fix it. Change-Id: Id2bc6741ad3366969fbb73dc64c23430ce66f2aa Closes-Bug: #1551099 (cherry picked from commit 79c531a1c479a8f35ffb66dcf6daceb8dcf03a1a) --- openstack_dashboard/dashboards/settings/user/forms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openstack_dashboard/dashboards/settings/user/forms.py b/openstack_dashboard/dashboards/settings/user/forms.py index adf965640f..55022205f8 100644 --- a/openstack_dashboard/dashboards/settings/user/forms.py +++ b/openstack_dashboard/dashboards/settings/user/forms.py @@ -13,6 +13,7 @@ # under the License. from datetime import datetime # noqa +from datetime import timedelta # noqa import string import babel @@ -30,8 +31,7 @@ from horizon import messages def _one_year(): now = datetime.utcnow() - return datetime(now.year + 1, now.month, now.day, now.hour, - now.minute, now.second, now.microsecond, now.tzinfo) + return now + timedelta(days=365) class UserSettingsForm(forms.SelfHandlingForm):