DateObjectSerializer.js 268 B

12345678910111213141516
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. */
  4. "use strict";
  5. class DateObjectSerializer {
  6. serialize(obj, { write }) {
  7. write(obj.getTime());
  8. }
  9. deserialize({ read }) {
  10. return new Date(read());
  11. }
  12. }
  13. module.exports = DateObjectSerializer;