Skip to content

Commit d80d565

Browse files
committed
use scale_factor and unit in cast_value for datetime
1 parent 1cb7734 commit d80d565

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/zarr/core/dtype/npy/time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def from_json_value(self, data: JSON, *, zarr_format: ZarrFormat) -> np.datetime
240240
raise TypeError(f"Invalid type: {data}. Expected an integer.") # pragma: no cover
241241

242242
def _cast_value_unsafe(self, data: object) -> np.datetime64:
243-
return self.to_dtype().type(data) # type: ignore[no-any-return, call-overload]
243+
return self.to_dtype().type(data, f"{self.scale_factor}{self.unit}") # type: ignore[no-any-return, call-overload]
244244

245245
@classmethod
246246
def check_json(cls, data: JSON, zarr_format: ZarrFormat) -> TypeGuard[JSON]:

0 commit comments

Comments
 (0)