Changed the scheduled_for datetime to only send and hour of a day to send.

Also expect the date being passed in is BST. The date is converted to UTC before saving. And converted to BST when returning a notification.
This commit is contained in:
Rebecca Law
2017-05-17 15:06:15 +01:00
parent 5f8338dd80
commit 973cc2c4c9
14 changed files with 64 additions and 46 deletions

View File

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