From 88af7966d0545106955e7c6537dda62d3ace43c0 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Wed, 26 Sep 2018 04:15:53 +0100 Subject: [PATCH] Fix atfd empty dateRanges (#798) ![image](https://user-images.githubusercontent.com/5896343/46051638-585fd080-c132-11e8-8e59-bfa5da70e32c.png) --- routes/atfd/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/routes/atfd/index.js b/routes/atfd/index.js index 39d872b90..c8f9e69e4 100644 --- a/routes/atfd/index.js +++ b/routes/atfd/index.js @@ -28,14 +28,14 @@ module.exports = async (ctx) => { Referer: host, }, }); - const data = response.data.data; + const data = response.data.data.slice(0, 10); ctx.state.data = { title: 'All the Flight Deals', link: host, description: 'All the Flight Deals', item: data.map((item) => ({ - title: `[${dayjs(item.dateRanges[0].start).format('YYYY MMM DD')} to ${dayjs(item.dateRanges[0].end).format('YYYY MMM DD')}] ${item.title}`, + title: `[${item.dateRanges[0] ? dayjs(item.dateRanges[0].start).format('YYYY MMM DD') + 'to' + dayjs(item.dateRanges[0].end).format('YYYY MMM DD') : ''}] ${item.title}`, description: `${item.cityPairs[0].destination.city},${
                 item.cityPairs[0].destination.countryName
             }
FromToPrice
${