Issue with the order of the blogs using publish date

  1. I have exported blogs from drupal and imported in contentful. Here I am using publish date as a field and got the timestamp from drupal.
  2. Using the timestamp I was able to sort using the timestamp (publishdate field).
  3. Now to create new blogs in contentful I am considering publishdate(formatted field with DD MM YYYY) for sorting. But the system doesn’t sort it accurately.

I want to sort the blogs using publishdate(custom formatted field with DD MM YYYY). Here for the old ones I will be getting timestamp and for the new ones custom format. Help me how to sort them ascending or descending order. Thanks.

Can you please help on this?

Hello,

If you’re using the GraphQL API, you can pass on the order parameter. The GraphQL query might look as follow:

{
  blogArticleCollection(order: sys_firstPublishedAt_DESC) {
    items {
      title
      sys {
        firstPublishedAt
      }
    }
  }
}

Hi Harshil,

Thank you for reply. I am not using GraphQL API, using contentful client getEntries API calls. Can you provide a solution using contentful client API calls. Thanks.