当我尝试选择start_date:“ 2018-03-06T05:16:21.078Z和end_date:” 2017-03-08T05:16:21.078Z但在日志中总是说的时候

Executing (default):

SELECT `order_number`, `distribute_channel`, `sku_name`, `buyer_name`, `buyer_email`,
    `buyer_mobile`, `quantity`, `id_principal`, `total_nominal`,
    `posting_date`, `distribute_date`
FROM `central_ile` AS `centralIle`
WHERE `centralIle`.`order_number` = '213149361835030' AND
      `centralIle`.`created_date` = '2018-09-13 17:00:00'
LIMIT 0, 10;de here


这是我的剧本

let start_date= req.body.start_date
let end_date = req.body.end_date
let whereStatement = {}

 if (start_date && end_date) {
            whereStatement.created_date = {
                created_date : {
                    $between :[start_date , end_date]
                },
            }
        }
      let centralIleData = await CentralIle.findAll({
            raw:true,
            nest:true,
            where : whereStatement,
       })


我的代码中实际上有什么错?

最佳答案

您能这样尝试吗?它应该工作

whereStatement.created_date = { $between :[start_date , end_date] }

07-28 09:57