fix serialization for all temporal type

Added changes to #557 fix to resolve also #492