Skip to content

Commit

Permalink
Making datetime operations more forgiving w/r/t nill values.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed May 28, 2021
1 parent ccdb84d commit 5529872
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tech/v3/datatype/datetime/operations.clj
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@
:temporal (let [tf (ensure-temporal-amount tf)]
(reify BinaryOperators$ObjectBinaryOperator
(binaryObject [this lhs rhs]
(.plus ^Temporal lhs (unchecked-long rhs) tf))))
(when lhs
(.plus ^Temporal lhs (unchecked-long rhs) tf)))))
:epoch (let [epoch-conv (long (dt-base/epoch->microseconds dtype))
tf-conv (long (dt-base/relative->microseconds tf))]
(reify BinaryOperators$LongBinaryOperator
Expand Down Expand Up @@ -447,7 +448,8 @@
:temporal (let [tf (ensure-temporal-amount tf)]
(reify BinaryOperators$ObjectBinaryOperator
(binaryObject [this lhs rhs]
(.minus ^Temporal lhs (unchecked-long rhs) tf))))
(when lhs
(.minus ^Temporal lhs (unchecked-long rhs) tf)))))
:epoch (let [epoch-conv (long (dt-base/epoch->microseconds dtype))
tf-conv (long (dt-base/relative->microseconds tf))]
(reify BinaryOperators$LongBinaryOperator
Expand Down

0 comments on commit 5529872

Please sign in to comment.