From fe2e8bcbf7a255b221b3ffdacd79150844a7719a Mon Sep 17 00:00:00 2001 From: Owen Stephens Date: Fri, 22 Jun 2018 23:40:20 +0100 Subject: [PATCH] Change behaviour of DecoratedValue to handle dates better --- .../src/com/google/refine/browsing/DecoratedValue.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main/src/com/google/refine/browsing/DecoratedValue.java b/main/src/com/google/refine/browsing/DecoratedValue.java index 398d8cb34..90bde0930 100644 --- a/main/src/com/google/refine/browsing/DecoratedValue.java +++ b/main/src/com/google/refine/browsing/DecoratedValue.java @@ -33,12 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.refine.browsing; +import java.time.OffsetDateTime; import java.util.Properties; import org.json.JSONException; import org.json.JSONWriter; import com.google.refine.Jsonizable; +import com.google.refine.util.StringUtils; /** * Store a value and its text label, in case the value is not a string itself. @@ -52,8 +54,12 @@ public class DecoratedValue implements Jsonizable { final public String label; public DecoratedValue(Object value, String label) { - this.value = value; - this.label = label; + if (value instanceof OffsetDateTime) { + this.value = StringUtils.toString(value); + } else { + this.value = value; + } + this.label = label; } @Override