function parseTimestamps(garden) {

  const newGarden = Object.assign({}, garden);

  newGarden.squares = newGarden.squares.map((square) => {
    const timestamps = ['datePlanted', 'lastWatered'];
    const formatted = {};

    timestamps.forEach((timestamp) => {
      if (square[timestamp]) {
        formatted[timestamp] = new Date(square[timestamp]);
      }
    });

    return Object.assign({}, square, formatted);
  });


  return newGarden;
}
// Convert timestamps from text to datetime
Convert timestamps from text to datetime
Convert timestamps from text to datetime
function parseTimestamps(garden) {
  const newGarden = Object.assign({}, garden);
  newGarden.squares = newGarden.squares.map((square) => {
    const timestamps = ['datePlanted', 'lastWatered'];
    const formatted = {};
    timestamps.forEach((timestamp) => {
      if (square[timestamp]) {
        formatted[timestamp] = new Date(square[timestamp]);
      }
    });
    return Object.assign({}, square, formatted);
  });
  return newGarden;
}
function parseTimestamps ( garden ) { const newGarden = Object . assign ( { } , garden ) ; newGarden . squares = newGarden . squares . map ( ( square ) => { const timestamps = [ 'datePlanted' , 'lastWatered' ] ; const formatted = { } ; timestamps . forEach ( ( timestamp ) => { if ( square [ timestamp ] ) { formatted [ timestamp ] = new Date ( square [ timestamp ] ) ; } } ) ; return Object . assign ( { } , square , formatted ) ; } ) ; return newGarden ; }
Convert timestamps from text to datetime
Convert timestamps from text to datetime