To make the pastry, mix the flour and icing sugar together in a bowl. Add the butter and rub it in lightly with your fingertips until the mixture resembles fine breadcrumbs. Alternatively, do this in a food processor and then transfer to a bowl.
In a separate bowl, mix the egg with the lemon juice and two tablespoons of water. Make a well in the centre of the flour mixture and pour in the egg mix. Using a table knife, work the liquid into the flour to bring the pastry together. If it seems too dry, add a splash more water. When the dough begins to stick together, use your hands to gently knead it into a ball. Wrap in cling film and rest in the fridge for at least 15 minutes.
For the filling, put the chopped dates and milk in a pan. Bring to the boil, and then set aside for 30 minutes to soak.
For the toffee sauce, heat the sugar, butter and cream together in a pan over a low heat until melted and smooth, then bring to a simmer and let it bubble for five minutes to thicken. Leave to cool.
Preheat the oven to 180C/350F/Gas 4 and put a baking tray on the middle shelf to warm up.
Roll out the pastry on a lightly floured work surface and use it to line the tart tin. Prick the base with a fork. Slice each quarter of pear in two. Arrange in a circular fan pattern in the tart case. Drizzle over four tablespoons of the toffee sauce and put the tart in the fridge while you prepare the rest of the filling.
For the filling, mash the date mixture to a coarse purÃ©e with a potato masher. Tip it into a bowl with the softened butter, vanilla, flour, bicarbonate of soda, ground almonds, eggs, sugar and treacle. Whisk together with an electric whisk until just combined. Stir in the chopped nuts.
Spoon the mixture over the pears in the pastry case, spreading it out evenly. Bake the tart on the hot baking tray for 40-45 minutes, or until the filling is well risen and browned. Leave to stand for 10 minutes before removing from the tin.
Serve the tart warm, with clotted cream or ice cream and the rest of the toffee sauce.