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

Merge object passed to `localeUtils` with Utils #46

Closed
gpbl opened this Issue Jul 31, 2015 · 4 comments

Comments

2 participants
@gpbl
Owner

gpbl commented Jul 31, 2015

No description provided.

@gpbl gpbl added the new feature label Jul 31, 2015

@gpbl gpbl modified the milestone: v2.0.0 Oct 11, 2015

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Oct 18, 2015

Owner

I should extract from Utils those function first, otherwise there's the risk a developer would overwrite functions used internally. So Utils should be renamed LocaleUtils, while addons/LocaleUtils should be renamed MomentUtils (or something like that). The internal functions could be moved to Helpers.

Owner

gpbl commented Oct 18, 2015

I should extract from Utils those function first, otherwise there's the risk a developer would overwrite functions used internally. So Utils should be renamed LocaleUtils, while addons/LocaleUtils should be renamed MomentUtils (or something like that). The internal functions could be moved to Helpers.

@gpbl gpbl removed this from the v2.0.0 milestone Nov 3, 2015

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Nov 3, 2015

Owner

Starting from v1.1, a way for solving this issue is to extends the default localeUtils, e.g.:

import { localeUtils } from "react-day-picker/utils";
function formatMonthTitle() {
 return "Custom Month Title"
}

<DayPicker localeUtils={{ ...LocaleUtils, formatMonthTitle }} />
Owner

gpbl commented Nov 3, 2015

Starting from v1.1, a way for solving this issue is to extends the default localeUtils, e.g.:

import { localeUtils } from "react-day-picker/utils";
function formatMonthTitle() {
 return "Custom Month Title"
}

<DayPicker localeUtils={{ ...LocaleUtils, formatMonthTitle }} />

@gpbl gpbl closed this Nov 3, 2015

@bvaughn

This comment has been minimized.

Show comment
Hide comment
@bvaughn

bvaughn Nov 6, 2015

FWYI, (since you pointed to this example in the release notes), I think your example is actually the opposite of what you meant. I think you want...

import { localeUtils } from "react-day-picker/utils";
function formatMonthTitle() {
 return "Custom Month Title"
}

<DayPicker localeUtils={{ ...LocaleUtils, formatMonthTitle }} />

(The custom formatMonthTitle should come after the spread, or it will be overridden by the defaults.)

bvaughn commented Nov 6, 2015

FWYI, (since you pointed to this example in the release notes), I think your example is actually the opposite of what you meant. I think you want...

import { localeUtils } from "react-day-picker/utils";
function formatMonthTitle() {
 return "Custom Month Title"
}

<DayPicker localeUtils={{ ...LocaleUtils, formatMonthTitle }} />

(The custom formatMonthTitle should come after the spread, or it will be overridden by the defaults.)

@gpbl

This comment has been minimized.

Show comment
Hide comment
@gpbl

gpbl Nov 6, 2015

Owner

Thanks! I fixed the comment 👍

Owner

gpbl commented Nov 6, 2015

Thanks! I fixed the comment 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment