uranusjr commented on code in PR #69100:
URL: https://github.com/apache/airflow/pull/69100#discussion_r3510854318


##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/Context.kt:
##########
@@ -63,9 +81,31 @@ data class Context(
   @JvmField val ti: TaskInstance,
 ) {
   internal companion object {
+    private fun toDateTime(value: Any?): OffsetDateTime? =
+      when (value) {
+        is OffsetDateTime -> value
+        is String -> runCatching { OffsetDateTime.parse(value) }.getOrNull()
+        else -> null

Review Comment:
   Same for `toConf`. Also it might be a good idea to implement these as 
extension functions so we can write `logicalDate.toDateTime()` etc.
   
   https://kotlinlang.org/docs/extensions.html#extension-functions



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to