mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Add function to estimate letter delivery date
Letter delivery depends on: - how long it takes to print - how long it takes to post Both of these process are impacted by weekends, because people don’t work on weekends. It also depends on if you submit your letter before or after 5pm, because that’s the cut off time for getting a letter printed on a given day – ie after 5pm on Monday is effectively the same as Tuesday and so on. But I reckon all our users need to know is roughly how long it will take until the letter turns up on the user’s doorstep. So this commit adds a function to calculate this. Doesn’t surface it on the front end _yet_.
This commit is contained in:
@@ -7,7 +7,6 @@ from time import monotonic
|
||||
|
||||
import dateutil
|
||||
import itertools
|
||||
import pytz
|
||||
import ago
|
||||
from flask import (
|
||||
Flask,
|
||||
@@ -58,6 +57,8 @@ from app.notify_client.organisations_client import OrganisationsClient
|
||||
from app.notify_client.models import AnonymousUser
|
||||
from app.notify_client.letter_jobs_client import LetterJobsClient
|
||||
|
||||
from app.utils import gmt_timezones
|
||||
|
||||
login_manager = LoginManager()
|
||||
csrf = CsrfProtect()
|
||||
|
||||
@@ -215,12 +216,6 @@ def syntax_highlight_json(code):
|
||||
return Markup(highlight(code, JavascriptLexer(), HtmlFormatter(noclasses=True)))
|
||||
|
||||
|
||||
def gmt_timezones(date):
|
||||
date = dateutil.parser.parse(date)
|
||||
forced_utc = date.replace(tzinfo=pytz.utc)
|
||||
return forced_utc.astimezone(pytz.timezone('Europe/London'))
|
||||
|
||||
|
||||
def format_datetime(date):
|
||||
return '{} at {}'.format(
|
||||
format_date(date),
|
||||
|
||||
Reference in New Issue
Block a user