sequelize-between-date-range总是返回今天的日期,而不是记录中的日期

hivapdat  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(311)

当我尝试选择开始日期:“2018-03-06t05:16:21.078z”和结束日期:“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,
       })

我的代码有什么问题?

knpiaxh1

knpiaxh11#

你能这样试试吗。应该有用的

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

相关问题