date encoder for json