Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

Undefined dob is treated by moment as today #353

Open
jfly opened this issue Mar 15, 2017 · 0 comments
Open

Undefined dob is treated by moment as today #353

jfly opened this issue Mar 15, 2017 · 0 comments
Labels
Milestone

Comments

@jfly
Copy link
Member

jfly commented Mar 15, 2017

We've got a few places where we construct a moment out of a dob:

~/gitting/ccm @kaladin> git grep "moment.*dob"
imports/startup/server/exportResults.js:        let iso8601Date = formatMomentDateIso8601(moment(registration.dob));
imports/startup/server/methods.js:        dob: moment.utc(wcaPerson.dob).toDate(),
imports/startup/server/methods.js:        dob: moment.utc(wcaPerson.dob).toDate(),
imports/ui/pages/editProfile.jsx:    return this.props.user ? formatMomentDate(moment(this.props.user.profile.dob)) : null;
imports/ui/pages/manage/manageCheckin.jsx:                    {formatMomentDateIso8601(moment(registration.dob))}
imports/ui/pages/manage/manageScrambles.jsx:                    {formatMomentDateIso8601(moment(registration.dob))}

Interestingly enough, when you pass undefined into moment, you get today:

> moment(null).format()
"Invalid date"
> moment(undefined).format()
"2017-03-15T11:02:03-07:00"

Maybe the best solution is to create a ccmMoment method that checks for undefined and returns null instead of a moment representing right now?

The delegate crash course says "If you still end up missing the date of birth for a competitor, please leave it blank (i.e. "0000-00-00") and do not enter bogus dates such as "1900-01-01"."

@jfly jfly added the bug label Mar 15, 2017
@jfly jfly added this to the Phase 1 milestone Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant