Use UTC tz for determining TO status
This commit is contained in:
parent
6eb64d4aae
commit
a2d201e43b
@ -8,6 +8,7 @@ from werkzeug.datastructures import FileStorage
|
||||
|
||||
from atst.models import Attachment, Base, mixins, types
|
||||
from atst.models.clin import JEDICLINType
|
||||
from atst.utils.clock import Clock
|
||||
|
||||
|
||||
class Status(Enum):
|
||||
@ -81,7 +82,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
|
||||
@property
|
||||
def status(self):
|
||||
today = date.today()
|
||||
today = Clock.today()
|
||||
|
||||
if not self.is_completed and not self.is_signed:
|
||||
return Status.DRAFT
|
||||
@ -105,7 +106,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
@property
|
||||
def days_to_expiration(self):
|
||||
if self.end_date:
|
||||
return (self.end_date - date.today()).days
|
||||
return (self.end_date - Clock.today()).days
|
||||
|
||||
@property
|
||||
def total_obligated_funds(self):
|
||||
|
10
atst/utils/clock.py
Normal file
10
atst/utils/clock.py
Normal file
@ -0,0 +1,10 @@
|
||||
import pendulum
|
||||
|
||||
class Clock(object):
|
||||
@classmethod
|
||||
def today(cls, tz="UTC"):
|
||||
return pendulum.today(tz=tz).date()
|
||||
|
||||
@classmethod
|
||||
def now(cls, tz="UTC"):
|
||||
return pendulum.now(tz=tz)
|
Loading…
x
Reference in New Issue
Block a user