如何在给定的日期范围内进行检查
P粉494151941
P粉494151941 2023-09-07 20:25:21
0
1
558

我有两个不同的数组:

accomodation: [
  {
    id: 1,
    name: "Senator Hotel Fnideq",
    address: "Route de Ceuta, 93100 Fnidek, Morocco",
    checkin: "September 1",
    fullCheckinDate: "2021-09-01",
    checkout: "September 3",
    fullCheckoutDate: "2021-09-03",
    nights: 2,
    mealplan: "Breakfast,Lunch"
  },
  {
    id: 2,
    name: "Kabek Morocco Hotel",
    address: "Omis Juy, 93100 Kabek, Morocco",
    checkin: "September 3",
    fullCheckinDate: "2021-09-03",
    checkout: "September 5",
    fullCheckoutDate: "2021-09-05",
    nights: 2,
    mealplan: "Breakfast,Lunch"
  }
]
experiences: [
        {
            id: 1,
            fullDate: "2021-09-01",
            title: "Arrival",
            itinerary: // []
        },
        {
          id: 2,
          fullDate: "2021-09-02",
          title: "Sightseeing",
          itinerary: // []
        }
    ]

我想找到一种方法将住宿和体验之间相同的日期组合成一个对象。

myTrips: [
  {
    accomodation: {
      id: 1,
      name: "Senator Hotel Fnideq",
      address: "Route de Ceuta, 93100 Fnidek, Morocco",
      checkin: "September 1",
      fullCheckinDate: "2021-09-01",
      checkout: "September 3",
      fullCheckoutDate: "2021-09-03",
      nights: 2,
      mealplan: "Breakfast,Lunch"
    },
    experiences: {
       id: 1,
       fullDate: "2021-09-01",
       title: "Arrival",
       itinerary: // []
    }
  },
  //... 另一个对象
]

我正在使用dayjs来处理日期。我该如何处理这个问题?

P粉494151941
P粉494151941

全部回复(1)
P粉296080076

雷雷
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板