Skip to content

Commit

Permalink
Fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
moriyoshi committed Feb 15, 2021
1 parent 7e30d6c commit 447b30b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/DateTime.js
Expand Up @@ -451,7 +451,7 @@ export default class Datetime extends React.Component {
let needsUpdate = false;
let thisProps = this.props;

['locale', 'utc', 'displayZone', 'dateFormat', 'timeFormat'].forEach( function(p) {
['locale', 'utc', 'displayTimeZone', 'dateFormat', 'timeFormat'].forEach( function(p) {
prevProps[p] !== thisProps[p] && (needsUpdate = true);
});

Expand Down
10 changes: 8 additions & 2 deletions test/tests.spec.js
Expand Up @@ -919,29 +919,35 @@ describe('Datetime', () => {
it('displayTimeZone -> value should change format (undefined->America/New_York)', () => {
const date = new Date(2000, 0, 15, 2, 2, 2, 2),
momentDate = moment(date),
component = utils.createDatetime({ value: momentDate }),
component = utils.createDatetime({ initialViewMode: 'time', timeFormat: 'HH', value: momentDate }),
displayTimeZone = (moment.tz.guess() === 'America/New_York' ? 'America/Los_Angeles' : 'America/New_York');

const valueBefore = utils.getInputValue(component);
const timeCountBefore = component.find('.rdtCount').text();
component.setProps({ displayTimeZone: displayTimeZone }, () => {
const valueAfter = utils.getInputValue(component);

expect(valueBefore).not.toEqual(valueAfter);
});
const timeCountAfter = component.find('.rdtCount').text();
expect(timeCountBefore).not.toEqual(timeCountAfter);
});

it('displayTimeZone -> value should change format (America/New_York->undefined)', () => {
const date = new Date(2000, 0, 15, 2, 2, 2, 2),
momentDate = moment(date),
displayTimeZone = (moment.tz.guess() === 'America/New_York' ? 'America/Los_Angeles' : 'America/New_York'),
component = utils.createDatetime({ value: momentDate, displayTimeZone: displayTimeZone });
component = utils.createDatetime({ initialViewMode: 'time', timeFormat: 'HH', value: momentDate, displayTimeZone: displayTimeZone });

const valueBefore = utils.getInputValue(component);
const timeCountBefore = component.find('.rdtCount').text();
component.setProps({ displayTimeZone: undefined }, () => {
const valueAfter = utils.getInputValue(component);

expect(valueBefore).not.toEqual(valueAfter);
});
const timeCountAfter = component.find('.rdtCount').text();
expect(timeCountBefore).not.toEqual(timeCountAfter);
});

it('locale -> picker should change language (initialViewMode=days)', () => {
Expand Down

0 comments on commit 447b30b

Please sign in to comment.