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

Relative time is not correct #3699

Closed
mirkus90 opened this issue Feb 3, 2021 · 6 comments · Fixed by #4821
Closed

Relative time is not correct #3699

mirkus90 opened this issue Feb 3, 2021 · 6 comments · Fixed by #4821
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. ExemptFromDailyDRIReport exempt from daily DRI report front-burner needs-scheduling needs-team-attention p1 Painful if we don't fix, won't block releasing

Comments

@mirkus90
Copy link

mirkus90 commented Feb 3, 2021

Screenshots

image

Labels are in Italian.
"Oggi" => "today"

All the messages, both from the user and the bot, have timestamp around 2th February 3:30 PM, whereas the screenshot was done at around 3th February 11:15 AM.

Version

Custom ReactJS webchat, created using the "botframework-webchat" 4.8.0 npm package

Describe the bug

Activities related to "yesterday" are marked as "today". For example, with current timestamp "3th February 11:15 AM", an activity with timestamp "2th February 3:30 PM" is showed as "today" in the webchat.
The reason is that in the "useRelativeTimeFormatter.js" file the logic is done with delta time within 24 hours, regardless the current day.

Steps to reproduce

  1. Go to the webchat
  2. Generate some activities
  3. Wait until the day after
  4. See the incorrect behavior

Expected behavior

When the activity is related to the day before the current day, it should be shown as "yesterday".

[Bug]

@mirkus90 mirkus90 added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-reported Required for internal Azure reporting. Do not delete. labels Feb 3, 2021
@mirkus90
Copy link
Author

mirkus90 commented Feb 3, 2021

@corinagum @compulim added for information, as marked like contributors on the "useRelativeTimeFormatter.js" file

@corinagum
Copy link
Contributor

To my knowledge this is standard behavior for timestamp diffs. Do you have an example of this not being the case in other apps? If so that will help us discuss with the design team moving forward.

@corinagum corinagum self-assigned this Feb 3, 2021
@corinagum corinagum added the customer-replied-to Required for internal reporting. Do not delete. label Feb 3, 2021
@mirkon90
Copy link

mirkon90 commented Feb 3, 2021

@corinagum for example, in Whatsapp all the messages related to the day before, even if they have been sent less than 24 hours, are marked in the section "Yesterday". Usually, I guess this is the common behaviour when referring to the day before.

@corinagum
Copy link
Contributor

I'm adding this to our front-burner for consideration for our next release.

@corinagum corinagum added backlog Out of scope for the current iteration but it will be evaluated in a future release. front-burner and removed needs-team-attention labels Feb 3, 2021
@corinagum corinagum removed their assignment Feb 4, 2021
@compulim compulim added the ExemptFromDailyDRIReport exempt from daily DRI report label Feb 17, 2021
@compulim
Copy link
Contributor

Note for @corinagum, inside useRelativeTimeFormatter.js:

const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())

// Around 5 hours
if (today > new Date(activity.timestamp)) {
  // It is yesterday
  return localize('ACTIVITY_STATUS_TIMESTAMP_YESTERDAY');
}

@corinagum corinagum added this to the R14 milestone Apr 26, 2021
@Kaiqb Kaiqb added the p1 Painful if we don't fix, won't block releasing label Jun 16, 2021
@compulim compulim modified the milestones: R14, R15 Jun 16, 2021
@compulim compulim removed this from the R15 milestone Jun 29, 2021
@cappe89
Copy link

cappe89 commented Oct 5, 2021

I have the same issue. The problem is for messages between 24 and 25 hours ago (the same for 48 and 49).

A simple solution could be convert <= to < at lines 40 and 42

if (deltaInHours < 24) { return localize('ACTIVITY_STATUS_TIMESTAMP_TODAY'); } else if (deltaInHours < 48) { return localize('ACTIVITY_STATUS_TIMESTAMP_YESTERDAY'); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. ExemptFromDailyDRIReport exempt from daily DRI report front-burner needs-scheduling needs-team-attention p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants