Convert integers to strings first so that they work as year-only dates if target type is /type/datetime

git-svn-id: http://google-refine.googlecode.com/svn/trunk@2476 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
Tom Morris 2012-03-16 16:29:24 +00:00
parent 2acd4624cf
commit cebe009e2e

View File

@ -273,7 +273,12 @@ public class MqlwriteLikeTransposedNodeFactory implements TransposedNodeFactory
if (obj == null) {
obj = new JSONObject();
try {
obj.put(VALUE, node.value);
if ("/type/datetime".equals(node.valueType) && node.value instanceof Long) {
// Special case integers as year-only dates
obj.put(VALUE, node.value.toString());
} else {
obj.put(VALUE, node.value);
}
obj.put(TYPE, node.valueType);
if ("/type/text".equals(node.valueType)) {
obj.put(LANG, node.lang);