Skip to content

Text content did not match. Server when i'm using toLocaleDateString to format dates #6701

@mu7amad

Description

@mu7amad

Bug report

Describe the bug

I'm trying to display dates depend on local, and for that, I'm using toLocaleDateString()
API
i would like to know how to fix this console error.

To Reproduce

class Review extends React.Component {
    render() {
        const { review, theme } = this.props;
        const componentStyle = theme.components.review;
        const reviewDate = new Date(review.date);
        const date = reviewDate.toLocaleDateString('de-DE');
        return (
            <React.Fragment>
                <time dateTime={date}>{date}</time> <Seprator>{review.name ? '|' : ''}</Seprator>{' '}
                <span>{review.name}</span>
                <RatingBar rating={review.rating} />
                <H4 margin={`${componentStyle.title.marginTop} 0 ${componentStyle.title.marginBottom} 0`}>
                    {review.title}
                </H4>
                <Paragraph>{review.text}</Paragraph>
            </React.Fragment>
        );
    }
}

Screenshots

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions