Change behaviour of DecoratedValue to handle dates better
This commit is contained in:
parent
420c9bd1a5
commit
fe2e8bcbf7
@ -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,8 +54,12 @@ 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) {
|
||||||
this.value = value;
|
if (value instanceof OffsetDateTime) {
|
||||||
this.label = label;
|
this.value = StringUtils.toString(value);
|
||||||
|
} else {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user