spicygreenbook/greenbook-app

About - Volunteer page start date not fetching

Closed this issue · 2 comments

Describe the bug
About - Volunteer page start date not fetching correct date from database.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'About'
  2. Click on 'Volunteers'
  3. Click on any volunteer to see their profile
  4. See 'Started on' is always showing the current date

Expected behavior
It should be fetching the correct start dates from the database.

Screenshots
Inkedvolunteer-startdate-bug_LI

Desktop (please complete the following information):

  • OS: Windows 10 &
  • Browser: Chrome
  • Version: Version 91.0.4472.124 (Official Build) (64-bit)

Smartphone (please complete the following information):

  • Device: e.g. iPhone6
  • OS: iOS 13.3.1

Additional context

  • Same behavior is happening on iOS native and desktop web.

Date is fetched correctly, but butchered in one of the date representation codes. The combination of Date(new Date( turns the correct date into the current date.

Depending on what date format you want to show, you can use 1 of the following code-blocks in VolunteerModal.js at line 165 (for me)

DATE FORMAT: 08/31/20
{!!data._date_started && ( <View style={styles.volunteerDetailItem}> {!!isWeb ? ( <Text style={styles.text_body2}> Started on: {" " + new Date( data._date_started.value ).toLocaleDateString()} </Text> ) : ( <Text style={styles.text_body2}> Started on: {" " + new Date( split(data._date_started.value, "T")[0] ).toLocaleDateString()} </Text> )} </View> )}

DATE FORMAT: Mon Aug 31, 2020
{!!data._date_started && ( <View style={styles.volunteerDetailItem}> {!!isWeb ? ( <Text style={styles.text_body2}> Started on: {" " + new Date( data._date_started.value ).toLocaleDateString()} </Text> ) : ( <Text style={styles.text_body2}> Started on: {" " + new Date( split(data._date_started.value, "T")[0] ).toDateString()} </Text> )} </View> )}

Fixed with commit 4c7eec4b

Thank you to
@JeroenGoddijn for the code block