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
This commit is contained in:
parent
347023f35a
commit
79c531a1c4
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user