{"action":"opened","issue":{"url":"https://api.github.com/repos/alibaba/fastjson/issues/948","repository_url":"https://api.github.com/repos/alibaba/fastjson","labels_url":"https://api.github.com/repos/alibaba/fastjson/issues/948/labels{/name}","comments_url":"https://api.github.com/repos/alibaba/fastjson/issues/948/comments","events_url":"https://api.github.com/repos/alibaba/fastjson/issues/948/events","html_url":"https://github.com/alibaba/fastjson/issues/948","id":194896508,"number":948,"title":"1.2.22版本，Jdk8DateCodec里面的格式化格式不生效","user":{"login":"cnhans","id":563838,"avatar_url":"https://avatars.githubusercontent.com/u/563838?v=3","gravatar_id":"","url":"https://api.github.com/users/cnhans","html_url":"https://github.com/cnhans","followers_url":"https://api.github.com/users/cnhans/followers","following_url":"https://api.github.com/users/cnhans/following{/other_user}","gists_url":"https://api.github.com/users/cnhans/gists{/gist_id}","starred_url":"https://api.github.com/users/cnhans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cnhans/subscriptions","organizations_url":"https://api.github.com/users/cnhans/orgs","repos_url":"https://api.github.com/users/cnhans/repos","events_url":"https://api.github.com/users/cnhans/events{/privacy}","received_events_url":"https://api.github.com/users/cnhans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-12T05:58:54Z","updated_at":"2016-12-12T05:58:54Z","closed_at":null,"body":"fastjson 1.2.22版本\r\nJdk8DateCodec.java\r\n\r\nLocalDateTime dateTime = (LocalDateTime) object;\r\n                if (dateTime.getNano() == 0) {\r\n                    String format = serializer.getDateFormatPattern();\r\n                    if (format == null) {\r\n                        format = JSON.DEFFAULT_DATE_FORMAT;\r\n                    }\r\n                    write(out, dateTime, format);\r\n                } else {\r\n                    out.writeString(object.toString());\r\n                }\r\n\r\n看 这里是 dateTime.getNano() == 0 才会进行format处理，LocalDateTime.now()产生的时间，都是不成立的，所以在toString时，即使是这样设置，都不会生效：\r\n @Override\r\n    public String toString() {\r\n        return JSON.toJSONStringWithDateFormat(this,\"yyyy-MM-dd HH:mm:ss:SSS\",\r\n                SerializerFeature.DisableCircularReferenceDetect);\r\n    }"}}
{"actor":{"display_login":"cnhans"}}