Browse Source

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
Kenji Ishii 3 years ago
parent
commit
79c531a1c4
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      openstack_dashboard/dashboards/settings/user/forms.py

+ 2
- 2
openstack_dashboard/dashboards/settings/user/forms.py View File

@@ -13,6 +13,7 @@
13 13
 #    under the License.
14 14
 
15 15
 from datetime import datetime  # noqa
16
+from datetime import timedelta  # noqa
16 17
 import string
17 18
 
18 19
 import babel
@@ -30,8 +31,7 @@ from horizon import messages
30 31
 
31 32
 def _one_year():
32 33
     now = datetime.utcnow()
33
-    return datetime(now.year + 1, now.month, now.day, now.hour,
34
-                    now.minute, now.second, now.microsecond, now.tzinfo)
34
+    return now + timedelta(days=365)
35 35
 
36 36
 
37 37
 class UserSettingsForm(forms.SelfHandlingForm):

Loading…
Cancel
Save