Change behaviour of DecoratedValue to handle dates better

This commit is contained in:
Owen Stephens 2018-06-22 23:40:20 +01:00
parent 420c9bd1a5
commit fe2e8bcbf7

View File

@ -33,12 +33,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.browsing; package com.google.refine.browsing;
import java.time.OffsetDateTime;
import java.util.Properties; import java.util.Properties;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONWriter; import org.json.JSONWriter;
import com.google.refine.Jsonizable; 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. * Store a value and its text label, in case the value is not a string itself.
@ -52,7 +54,11 @@ public class DecoratedValue implements Jsonizable {
final public String label; final public String label;
public DecoratedValue(Object value, String label) { public DecoratedValue(Object value, String label) {
if (value instanceof OffsetDateTime) {
this.value = StringUtils.toString(value);
} else {
this.value = value; this.value = value;
}
this.label = label; this.label = label;
} }