Skip to content

Date when adding comments is displayed wrong. Makes whole library unusable #156

@nickjanssen

Description

@nickjanssen

Setup (always fill this in):

  • iOS or Android? both
  • Expo or regular React Native? React Native
  • React Native Version: 0.63.3
  • react-native-activity-feed or expo-activity-feed version: npm list --pattern <package-name>/yarn list --pattern <package-name>: react-native-activity-feed
  • getstream version: npm list --pattern getstream/yarn list --pattern getstream 4.5.4

Describe the bug
When adding a comment, the displayed time is one hour ahead. Comments have "in an hour" appended.
image

To Reproduce
Steps to reproduce the behavior:

  1. Live in Belgium
  2. Wait until winter (daylight savings must be active)
  3. Make a comment

I don't know whether daylight savings have something to do with it, but I'm guessing you guys aren't living here so probably never encountered this. So I'm betting it's the cause.

Expected behavior
That the time is displayed right. The text should display "just now" after the comment is made.

Additional context
See

export function humanizeTimestamp(

The bug is caused by humanizeTimestamp which for some reason appends one hour through utcOffset().

  // Following calculation is based on assumption that tDateTimeParser()
  // either returns momentjs or dayjs object.
  const time = tDateTimeParser(timestamp).add(
    Dayjs(timestamp).utcOffset(),
    'minute',
  ); // parse time as UTC

The timestamp is already in UTC format so this .add( call is unnecessary. Normally I'd make a PR but judging from the number of open PRs and tickets and lack of response I wonder why I even bother making this ticket.

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