Update dateformat for scheduled_for to include minutes.

This commit is contained in:
Rebecca Law
2017-05-22 14:15:35 +01:00
parent 3a3161ecc4
commit 751abb4b99
5 changed files with 9 additions and 9 deletions

View File

@@ -128,7 +128,7 @@ def simulated_recipient(to_address, notification_type):
def persist_scheduled_notification(notification_id, scheduled_for):
scheduled_datetime = convert_bst_to_utc(datetime.strptime(scheduled_for, "%Y-%m-%d %H"))
scheduled_datetime = convert_bst_to_utc(datetime.strptime(scheduled_for, "%Y-%m-%d %H:%M"))
scheduled_notification = ScheduledNotification(notification_id=notification_id,
scheduled_for=scheduled_datetime)
dao_created_scheduled_notification(scheduled_notification)

View File

@@ -25,10 +25,10 @@ def validate(json_to_validate, schema):
def validate_schema_date_with_hour(instance):
if isinstance(instance, str):
try:
datetime.strptime(instance, "%Y-%m-%d %H")
datetime.strptime(instance, "%Y-%m-%d %H:%M")
except ValueError as e:
raise ValidationError("datetime format is invalid. Use the format: "
"YYYY-MM-DD HH, for example 2017-05-30 13")
"YYYY-MM-DD HH:MI, for example 2017-05-30 13:15")
return True
validator = Draft4Validator(schema, format_checker=format_checker)