Repository: oppia/oppia

Issue:
"Invalid Date" Shown for Feedback in Learner Dashboard
**Describe the bug**
When opening a feedback thread in the learner dashboard, "Invalid Date" is shown in place of the date.

**To Reproduce**
Steps to reproduce the behavior:
 1. Leave feedback on an exploration suggesting a change
 2. Open the learner dashboard
 3. Open the thread for the feedback you just left

**Observed behavior**
"Invalid Date" is shown in place of the timestamp:

![Screen Shot 2020-02-09 at 15 13 59](https://user-images.githubusercontent.com/19878639/74112170-2bf1fc00-4b4f-11ea-9e21-ccdcd121b1c1.png)

**Expected behavior**
The correct timestamp should be shown.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox
 - Version: `release-2.9.0`

**Additional context**
The correct timestamp is shown before opening a thread:

![Screen Shot 2020-02-09 at 15 13 52](https://user-images.githubusercontent.com/19878639/74112150-006f1180-4b4f-11ea-8b07-7c8f7652baeb.png)
"Invalid Date" Shown for Feedback in Learner Dashboard
**Describe the bug**
When opening a feedback thread in the learner dashboard, "Invalid Date" is shown in place of the date.

**To Reproduce**
Steps to reproduce the behavior:
 1. Leave feedback on an exploration suggesting a change
 2. Open the learner dashboard
 3. Open the thread for the feedback you just left

**Observed behavior**
"Invalid Date" is shown in place of the timestamp:

![Screen Shot 2020-02-09 at 15 13 59](https://user-images.githubusercontent.com/19878639/74112170-2bf1fc00-4b4f-11ea-9e21-ccdcd121b1c1.png)

**Expected behavior**
The correct timestamp should be shown.

**Desktop (please complete the following information; delete this section if the issue does not arise on desktop):**
 - OS: macOS
 - Browser: Firefox
 - Version: `release-2.9.0`

**Additional context**
The correct timestamp is shown before opening a thread:

![Screen Shot 2020-02-09 at 15 13 52](https://user-images.githubusercontent.com/19878639/74112150-006f1180-4b4f-11ea-8b07-7c8f7652baeb.png)


Discussion:
I have also reproduced this in Chrome
Could you assign me this one.
I'll let you know if i can't reproduce it
Thanks
Hi @abhayraghuwanshi, I've assigned this to you.
![Screenshot from 2020-02-10 17-09-28](https://user-images.githubusercontent.com/45534131/74194950-451aab80-4c28-11ea-9dfa-19f351707503.png)
work fine on my Linux 18.04 Chrome Version 79.0.3945.130
Hi @abhayraghuwanshi, the image you have shared above isn't visible. Can you please check?

Also, FYI this issue is blocking the release so we are expecting to resolve it asap (before 12th Feb EOD).
![Screenshot from 2020-02-10 17-09-28](https://user-images.githubusercontent.com/45534131/74225625-15e85680-4c89-11ea-857a-f059f05f220d.png)

![Screenshot from 2020-02-11 04-45-03](https://user-images.githubusercontent.com/45534131/74225833-74add000-4c89-11ea-985d-dd6aef5bb4f4.png)
@DubeySandeep  it works fine on my chrome
@DubeySandeep i couldn't able to reproduce this, thats why i unassigned myself. If anyone wants to try that they can 
Thanks
@abhayraghuwanshi, Thanks for the updates!

@Showtim3, Can you please check whether this is reproducible?  
WOrking for me too...
![image](https://user-images.githubusercontent.com/30312043/74271559-1a694980-4d33-11ea-88fe-6c28d88b2a0a.png)

Hi @U8NWXD, Can you please share the exploration link in which you have reproduced this issue? (Maybe it's exploration specific issue?) 
Here's the exploration link: https://oppiatestserver.appspot.com/explore/kKqz0ElnAbLw
I'm not sure how to see the suggested changes without logging in as me though
@Showtim3 it looks like you left feedback instead of making a suggestion. I saw the bug when making a suggested change, so maybe this is the difference? I've updated the reproduction instructions to clarify. I also just checked, and I still see `Invalid Date`
Ok so I can reproduce this while making a suggestion, thanks @U8NWXD 
![image](https://user-images.githubusercontent.com/30312043/74671859-0a89b380-51d2-11ea-96fd-e94830c8c29e.png)

I am taking this up..
I have also reproduced this in Chrome
Could you assign me this one.
I'll let you know if i can't reproduce it
Thanks
Hi @abhayraghuwanshi, I've assigned this to you.
![Screenshot from 2020-02-10 17-09-28](https://user-images.githubusercontent.com/45534131/74194950-451aab80-4c28-11ea-9dfa-19f351707503.png)
work fine on my Linux 18.04 Chrome Version 79.0.3945.130
Hi @abhayraghuwanshi, the image you have shared above isn't visible. Can you please check?

Also, FYI this issue is blocking the release so we are expecting to resolve it asap (before 12th Feb EOD).
![Screenshot from 2020-02-10 17-09-28](https://user-images.githubusercontent.com/45534131/74225625-15e85680-4c89-11ea-857a-f059f05f220d.png)

![Screenshot from 2020-02-11 04-45-03](https://user-images.githubusercontent.com/45534131/74225833-74add000-4c89-11ea-985d-dd6aef5bb4f4.png)
@DubeySandeep  it works fine on my chrome
@DubeySandeep i couldn't able to reproduce this, thats why i unassigned myself. If anyone wants to try that they can 
Thanks
@abhayraghuwanshi, Thanks for the updates!

@Showtim3, Can you please check whether this is reproducible?  
WOrking for me too...
![image](https://user-images.githubusercontent.com/30312043/74271559-1a694980-4d33-11ea-88fe-6c28d88b2a0a.png)

Hi @U8NWXD, Can you please share the exploration link in which you have reproduced this issue? (Maybe it's exploration specific issue?) 
Here's the exploration link: https://oppiatestserver.appspot.com/explore/kKqz0ElnAbLw
I'm not sure how to see the suggested changes without logging in as me though
@Showtim3 it looks like you left feedback instead of making a suggestion. I saw the bug when making a suggested change, so maybe this is the difference? I've updated the reproduction instructions to clarify. I also just checked, and I still see `Invalid Date`
Ok so I can reproduce this while making a suggestion, thanks @U8NWXD 
![image](https://user-images.githubusercontent.com/30312043/74671859-0a89b380-51d2-11ea-96fd-e94830c8c29e.png)

I am taking this up..

Resolving patch:
diff --git a/core/controllers/learner_dashboard.py b/core/controllers/learner_dashboard.py
--- a/core/controllers/learner_dashboard.py
+++ b/core/controllers/learner_dashboard.py
@@ -175,7 +175,9 @@ def get(self, thread_id):
                 'description': suggestion_thread.subject,
                 'author_username': authors_settings[0].username,
                 'author_picture_data_url': (
-                    authors_settings[0].profile_picture_data_url)
+                    authors_settings[0].profile_picture_data_url),
+                'created_on': utils.get_time_in_millisecs(
+                    messages[0].created_on)
             }
             message_summary_list.append(suggestion_summary)
             messages.pop(0)


Test patch:
diff --git a/core/controllers/learner_dashboard_test.py b/core/controllers/learner_dashboard_test.py
--- a/core/controllers/learner_dashboard_test.py
+++ b/core/controllers/learner_dashboard_test.py
@@ -28,6 +28,7 @@
 from core.platform import models
 from core.tests import test_utils
 import feconf
+import utils
 
 (suggestion_models, feedback_models) = models.Registry.import_models([
     models.NAMES.suggestion, models.NAMES.feedback])
@@ -428,12 +429,16 @@ def test_get_suggestions_after_updating_suggestion_summary(self):
                 suggestion.change.state_name].content.html)
         response_dict = self.get_json(thread_url)
         messages_summary = response_dict['message_summary_list'][0]
+        first_suggestion = feedback_services.get_messages(thread_id)[0]
 
         self.assertEqual(
             messages_summary['author_username'], self.EDITOR_USERNAME)
         self.assertTrue(
             messages_summary['author_picture_data_url'].startswith(
                 'data:image/png;'))
+        self.assertEqual(
+            utils.get_time_in_millisecs(first_suggestion.created_on),
+            messages_summary['created_on'])
         self.assertEqual(
             messages_summary['suggestion_html'], '<p>new content html</p>')
         self.assertEqual(