From d331c6b9775a4164c1972660fb6a008b94cb85de Mon Sep 17 00:00:00 2001 From: Andrapyre <42009361+Andrapyre@users.noreply.github.com> Date: Mon, 6 May 2024 01:34:28 +0200 Subject: [PATCH] Revert "removing comparison in currency standard type" This reverts commit de36381092d3e181623421e6f025154a6162e86a. --- zio-schema/js/src/main/scala/zio/schema/StandardType.scala | 7 ++++--- .../native/src/main/scala/zio/schema/StandardType.scala | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/zio-schema/js/src/main/scala/zio/schema/StandardType.scala b/zio-schema/js/src/main/scala/zio/schema/StandardType.scala index f5cce667f..4f6f60940 100644 --- a/zio-schema/js/src/main/scala/zio/schema/StandardType.scala +++ b/zio-schema/js/src/main/scala/zio/schema/StandardType.scala @@ -166,9 +166,10 @@ object StandardType { } implicit object CurrencyType extends StandardType[java.util.Currency] { - override def tag: String = Tags.CURRENCY - override def defaultValue: Either[String, java.util.Currency] = Left("Currency generation not available in ScalaJS") - override def compare(x: java.util.Currency, y: java.util.Currency): Int = 0 + override def tag: String = Tags.CURRENCY + override def defaultValue: Either[String, java.util.Currency] = Left("Currency generation not available in ScalaJS") + override def compare(x: java.util.Currency, y: java.util.Currency): Int = + x.getCurrencyCode().compareTo(y.getCurrencyCode()) } implicit object BigDecimalType extends StandardType[java.math.BigDecimal] { diff --git a/zio-schema/native/src/main/scala/zio/schema/StandardType.scala b/zio-schema/native/src/main/scala/zio/schema/StandardType.scala index 8fd86f7e5..8d375b862 100644 --- a/zio-schema/native/src/main/scala/zio/schema/StandardType.scala +++ b/zio-schema/native/src/main/scala/zio/schema/StandardType.scala @@ -172,7 +172,8 @@ object StandardType { override def defaultValue: Either[String, java.util.Currency] = Left("Currency generation not available in Scala Native") - override def compare(x: java.util.Currency, y: java.util.Currency): Int = 0 + override def compare(x: java.util.Currency, y: java.util.Currency): Int = + x.getCurrencyCode().compareTo(y.getCurrencyCode()) } implicit object BigDecimalType extends StandardType[java.math.BigDecimal] {