improve Date conversion between java/js

I think it is better to use `new StringBuilder(chars.length + 8)` here.