mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-05 10:13:26 -05:00
Update dateformat for scheduled_for to include minutes.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user