decaporg / decaporg/decap-cms

Sorting with custom date format seems wrong

Open
#4,637 10 comments 1 reaction 1 assignee Claimed by @shashank-bairy View on GitHub
area: ui/collection type: bug
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**Describe the bug**
I have a `release-date` field with a custom `date_format` set to `DD-MM-YYYY`, so something like:
```yml
name: 'release-date'
label: 'Release date'
widget: 'datetime'
date_format: 'DD-MM-YYYY'
format: 'DD-MM-YYYY'
```
Then I have `release-date` set under `sortable_fields`, which gets recognized, but doesn't quite work as expected.

**Expected behavior**
I would expect the items to be listed considering the `date_format` and sorted by year first, then month, then day. Not the opposite as it seems to be happening.

**Screenshots**
![Screenshot 2020-11-26 at 17 10 22](https://user-images.githubusercontent.com/4265830/100378425-fa2d2180-300a-11eb-928c-043c45e0b748.png)

**Applicable Versions:**

- Netlify CMS version: 2.10.71
- Git provider: GitHub
- OS: macOS 11.0.1
- Browser version: Brave v1.16.76

- Node.JS version: 12.17.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.