Skip to content

Commit ccf6c79

Browse files
authored
fix: data can be a float as well (#460)
2 parents 461200b + 5ab1609 commit ccf6c79

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

geetools/ee_asset.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -775,11 +775,11 @@ def setProperties(self, **kwargs) -> ee.Asset:
775775
"""
776776
# time_start and time_end are only supporting the "str" format which is inconsistent with the API
777777
# return statement. To comply with a user expectation, we will do the conversions on our side.
778-
def date_in_str(d: str | int | datetime | date) -> str:
778+
def date_in_str(d: str | int | float | datetime | date) -> str:
779779
if isinstance(d, (datetime, date)):
780780
d = d.isoformat() + "Z" # add the Z to indicate UTC time as EE don't read ISO
781-
elif isinstance(d, int):
782-
d = datetime.fromtimestamp(d / 1000).isoformat() + "Z"
781+
elif isinstance(d, (int, float)):
782+
d = datetime.fromtimestamp(int(d) / 1000).isoformat() + "Z"
783783
return str(d) # if any other format is used, we will simply return it as a string
784784

785785
if "system:start_time" in kwargs:

0 commit comments

Comments
 (0)