Skip to content

Commit

Permalink
Date format fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoff Munn committed Apr 11, 2023
1 parent 8c04137 commit a70a486
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion terra_sdk/core/staking/data/delegation.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,15 @@ def to_data(self) -> dict:

@classmethod
def from_data(cls, data: dict) -> UnbondingDelegationEntry:

# The date needs to be formatted as a string. Add extra timezone details if required
date:str = parser.parse(data['completion_time']).strftime('%Y-%m-%d %H-%M-%S')

return cls(
initial_balance=data["initial_balance"],
balance=data["balance"],
creation_height=data["creation_height"],
completion_time=parser.parse(data["completion_time"]),
completion_time=date
)

def to_proto(self) -> UnbondingDelegationEntry_pb:
Expand Down
6 changes: 5 additions & 1 deletion terra_sdk/core/staking/data/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ def to_amino(self) -> dict:

@classmethod
def from_data(cls, data: dict) -> Commission:

# The date needs to be formatted as a string. Add extra timezone details if required
date:str = parser.parse(data['update_time']).strftime('%Y-%m-%d %H-%M-%S')

return cls(
commission_rates=CommissionRates.from_data(data["commission_rates"]),
update_time=parser.parse(data["update_time"]),
update_time=date
)

def to_proto(self) -> Commission_pb:
Expand Down

0 comments on commit a70a486

Please sign in to comment.