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

Allows for a custom display format #52

Merged
merged 2 commits into from
Sep 13, 2016
Merged

Conversation

majapw
Copy link
Collaborator

@majapw majapw commented Sep 1, 2016

Fix for #26

@jcreamer898

@majapw majapw added the semver-minor: new stuff Any feature or API addition. label Sep 1, 2016
@majapw majapw force-pushed the allow-for-custom-date-format branch from ded16c8 to 9410154 Compare September 1, 2016 23:14
@jcreamer898
Copy link

Well dang! Haha, that's awesome, you rock @majapw.

👍 👍

getDateString(date) {
const { displayFormat } = this.props;
if (displayFormat) {
return date && date.format(displayFormat);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when date is falsy, can you remind me what toLocalizedDateString will return?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toLocalizedString returns null for falsey dates. I'm going to go back and add some tests for that I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be better to do if (date && displayFormat) so that falsy dates always go through toLocalizedDateString? With the current approach, passing NaN with a format will return NaN, for example.

@majapw
Copy link
Collaborator Author

majapw commented Sep 2, 2016

Hmm, I just realized that this still expects L format dates when typing... I think that this prop should supercede that in that case as well.

@majapw majapw mentioned this pull request Sep 4, 2016
@averted averted mentioned this pull request Sep 6, 2016
@majapw majapw force-pushed the allow-for-custom-date-format branch 2 times, most recently from da34fe2 to 92f8f50 Compare September 12, 2016 23:22
@majapw
Copy link
Collaborator Author

majapw commented Sep 13, 2016

Hey @airbnb/webinfra can someone gimme a stamp on this?

@lencioni
Copy link
Contributor

LGTM

@majapw majapw merged commit 1932d7a into master Sep 13, 2016
@majapw majapw deleted the allow-for-custom-date-format branch September 13, 2016 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor: new stuff Any feature or API addition.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants