Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with date format #1563

Open
idkjs opened this issue May 21, 2020 · 0 comments
Open

Issue with date format #1563

idkjs opened this issue May 21, 2020 · 0 comments

Comments

@idkjs
Copy link

idkjs commented May 21, 2020

Reproduction can be seen at https://github.com/idkjs/WhatsAppCloneDockerNotes

Error is in ChatList.tsx

<ChatInfo>
    <ChatName data-testid="name">{chat.name}</ChatName>
    {chat.lastMessage && (
    <React.Fragment>
        <MessageContent data-testid="content">
        {chat.lastMessage.content}
        </MessageContent>
        <MessageDate data-testid="date">
        {format(chat.lastMessage.createdAt, 'HH:mm')}
        </MessageDate>
    </React.Fragment>
    )}
</ChatInfo>

Full Browser Error:

RangeError: Invalid time value
format
node_modules/date-fns/esm/format/index.js:371

  368 | var originalDate = toDate(dirtyDate);
  369 | 
  370 | if (!isValid(originalDate)) {
> 371 |   throw new RangeError('Invalid time value');
      | ^  372 | } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
  373 | // This ensures that when UTC functions will be implemented, locales will be compatible with them.
  374 | // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376

ChatsList/<
src/components/ChatsListScreen/ChatsList.tsx:106

  103 |   <MessageContent data-testid="content">
  104 |     {chat.lastMessage.content}
  105 |   </MessageContent>
> 106 |   <MessageDate data-testid="date">
      | ^  107 |     {format(chat.lastMessage.createdAt, 'HH:mm')}
  108 |   </MessageDate>
  109 | </React.Fragment>

ChatsList
src/components/ChatsListScreen/ChatsList.tsx:84

  81 | 
  82 | return (
  83 |   <Container>
> 84 |     <StyledList>
     | ^  85 |       {chats.map((chat: any) => (
  86 |         <StyledListItem
  87 |           key={chat.id}

I am trying to chase it down unless you are aware of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant