I have this:
export const pageQuery = graphql`
query {
site {
siteMetadata {
title
}
}
allMdx(sort: { fields: [frontmatter___date], order: DESC }) {
edges {
node {
excerpt
fields {
slug
}
frontmatter {
date(formatString: "DD 'de' MMMM, YYYY", locale: "pt")
title
description
}
}
}
}
}
`
in the line ->>
date(formatString: "DD 'de' MMMM, YYYY", locale: "pt")
I have to insert strings but this 'de' isnt working. I know I want to display the date like:
25 de March, 2020.
But the result is:
25 '32' March, 2020.
I know this isnt working, i know why, but I can't make it right.
I'm Using Gatsbyjs with graphql
Gatsby relies on moment.js to format dates.
To escape characters in format strings, you can wrap the custom string in square brackets.
date(formatString: "DD [de] MMMM, YYYY", locale: "pt")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With