# How to check duplicate time in array objects

**URL:** <https://community.postman.com/t/how-to-check-duplicate-time-in-array-objects/16424>\
**Category:** Help Hub\
**Created:** [October 1, 2020, 8:33pm UTC](https://community.postman.com/t/how-to-check-duplicate-time-in-array-objects/16424 "2020-10-01T20:33:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nataly.gamez](https://avatars.discourse-cdn.com/v4/letter/n/848f3c/32.png) [@nataly.gamez](https://community.postman.com/u/nataly.gamez)\
**Post date:** [October 1, 2020, 8:33pm UTC](https://community.postman.com/t/how-to-check-duplicate-time-in-array-objects/16424/1 "2020-10-01T20:33:04Z")

</div>

I need to know how should be the script to know if time is duplicated

```
[
{

        "time": "2020-09-29T00:00:00Z"

    },

    {

        "time": "2020-09-30T00:00:00Z"

    },

    {

        "time": "2020-09-30T00:00:00Z"

    },

    {

        "time": "2020-10-01T00:00:00Z"

    },

    {

        "time": "2020-10-01T00:00:00Z"

    }

]

```

i did it like this but the test is passing and should fail

```
pm.test("time is not duplicate ", function () {

    var jsonData = pm.response.json();

    let result = jsonData.reduce(function (arreglo, item) {

        let isDuplicate = arreglo.some(function (jsonData) {

            let condition = jsonData.time === item.time;

            return condition;

        });

        if (isDuplicate) {

            arreglo.push(item);

        }

        return arreglo;

    }, []);

    let hasDuplicates = result.length > 0;

    pm.expect(hasDuplicates).to.be.eql(false);

});
```
