# \[Rest API\] - Sort parameter not working for Date Fieldtype

**URL:** <https://discourse.getcockpit.com/t/rest-api-sort-parameter-not-working-for-date-fieldtype/889>\
**Category:** Support\
**Created:** [June 21, 2019, 5:31pm UTC](https://discourse.getcockpit.com/t/rest-api-sort-parameter-not-working-for-date-fieldtype/889 "2019-06-21T17:31:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![salus-sage](https://avatars.discourse-cdn.com/v4/letter/s/e5b9ba/32.png) [@salus-sage](https://discourse.getcockpit.com/u/salus-sage)\
**Post date:** [June 21, 2019, 5:31pm UTC](https://discourse.getcockpit.com/t/rest-api-sort-parameter-not-working-for-date-fieldtype/889/1 "2019-06-21T17:31:01Z")

</div>

Hi,

I struggled a lot to understand the sorting for rest api, and after some testing found that the date field type is not sorting.

Test condition,  
i have a test collection with just one field Date of Fieldtype date,  
and have these four dates, 2019-10-18, 2019-06-18, 2019-02-20, 2019-06-21  
my request url  
/api/collections/get/test1?sort[date]=-1&token=account-xxxx

But the response order is not sorted, below is the order i received

1. 2019-10-18,
2. 2019-06-18
3. 2019-02-20
4. 2019-06-21

Either the sort api is not working or there is some default sort, which am not able to figure out.  
Although i did find that Text Fieldtype sorting works, can anybody help me here please?  
3.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [June 21, 2019, 10:42pm UTC](https://discourse.getcockpit.com/t/rest-api-sort-parameter-not-working-for-date-fieldtype/889/2 "2019-06-21T22:42:14Z")

</div>

I can’t reproduce it (SQLite). Sorting works on the collection entries view and with api calls.

Do you use MongoDB or SQLite?  
Do you have any events (maybe in addons), that reorder the entries after they were found (`collections.find.after`)?
