import * as moment from 'moment'; import { Task } from './task.model'; export class TaskSerializer { public serialize(item: Task): {[key: string]: any} { const json: {[key: string]: any} = {}; if (item.id) { json['id'] = item.id; } if (item.lead) { json['lead_id'] = item.lead.id; } json['type'] = item.type; json['status'] = item.status; json['scheduled_for'] = moment(item.scheduledFor).format(); return json; } }