Skip to content

Commit

Permalink
Update React-Date-Picker to 8.1.0, React-Time-Picker to 4.2.0
Browse files Browse the repository at this point in the history
Closes #84
  • Loading branch information
wojtekmaj committed Mar 10, 2021
1 parent 8ee0175 commit 826849e
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
"prop-types": "^15.6.0",
"react-calendar": "^3.3.1",
"react-clock": "^3.0.0",
"react-date-picker": "^8.0.7",
"react-date-picker": "^8.1.0",
"react-fit": "^1.0.3",
"react-time-picker": "^4.1.0"
"react-time-picker": "^4.2.0"
},
"devDependencies": {
"@babel/cli": "^7.8.0",
Expand Down
18 changes: 9 additions & 9 deletions src/DateTimeInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ function datesAreDifferent(date1, date2) {

function isSameDate(date, year, month, day) {
return (
getYear(date) === year
&& getMonthHuman(date) === month
&& getDate(date) === day
year === getYear(date).toString()
&& month === getMonthHuman(date).toString()
&& day === getDate(date).toString()
);
}

Expand Down Expand Up @@ -185,12 +185,12 @@ export default class DateTimeInput extends PureComponent {
) {
if (nextValue) {
[, nextState.amPm] = convert24to12(getHours(nextValue));
nextState.year = getYear(nextValue);
nextState.month = getMonthHuman(nextValue);
nextState.day = getDate(nextValue);
nextState.hour = getHours(nextValue);
nextState.minute = getMinutes(nextValue);
nextState.second = getSeconds(nextValue);
nextState.year = getYear(nextValue).toString();
nextState.month = getMonthHuman(nextValue).toString();
nextState.day = getDate(nextValue).toString();
nextState.hour = getHours(nextValue).toString();
nextState.minute = getMinutes(nextValue).toString();
nextState.second = getSeconds(nextValue).toString();
} else {
nextState.amPm = null;
nextState.year = null;
Expand Down
72 changes: 36 additions & 36 deletions src/DateTimeInput.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(9);
expect(customInputs.at(1).prop('value')).toBe(30);
expect(customInputs.at(2).prop('value')).toBe(2017);
expect(customInputs.at(3).prop('value')).toBe(10);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('9');
expect(customInputs.at(1).prop('value')).toBe('30');
expect(customInputs.at(2).prop('value')).toBe('2017');
expect(customInputs.at(3).prop('value')).toBe('10');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

it('shows a given date in all inputs correctly given array of Date objects (12-hour format)', () => {
Expand All @@ -153,12 +153,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(9);
expect(customInputs.at(1).prop('value')).toBe(30);
expect(customInputs.at(2).prop('value')).toBe(2017);
expect(customInputs.at(3).prop('value')).toBe(10);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('9');
expect(customInputs.at(1).prop('value')).toBe('30');
expect(customInputs.at(2).prop('value')).toBe('2017');
expect(customInputs.at(3).prop('value')).toBe('10');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

it('shows a given date in all inputs correctly given ISO string (12-hour format)', () => {
Expand All @@ -176,12 +176,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(9);
expect(customInputs.at(1).prop('value')).toBe(30);
expect(customInputs.at(2).prop('value')).toBe(2017);
expect(customInputs.at(3).prop('value')).toBe(10);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('9');
expect(customInputs.at(1).prop('value')).toBe('30');
expect(customInputs.at(2).prop('value')).toBe('2017');
expect(customInputs.at(3).prop('value')).toBe('10');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

itIfFullICU('shows a given date in all inputs correctly given Date (24-hour format)', () => {
Expand All @@ -200,12 +200,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(2017);
expect(customInputs.at(1).prop('value')).toBe(9);
expect(customInputs.at(2).prop('value')).toBe(30);
expect(customInputs.at(3).prop('value')).toBe(22);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('2017');
expect(customInputs.at(1).prop('value')).toBe('9');
expect(customInputs.at(2).prop('value')).toBe('30');
expect(customInputs.at(3).prop('value')).toBe('22');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

itIfFullICU('shows a given date in all inputs correctly given array of Date objects (24-hour format)', () => {
Expand All @@ -224,12 +224,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(2017);
expect(customInputs.at(1).prop('value')).toBe(9);
expect(customInputs.at(2).prop('value')).toBe(30);
expect(customInputs.at(3).prop('value')).toBe(22);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('2017');
expect(customInputs.at(1).prop('value')).toBe('9');
expect(customInputs.at(2).prop('value')).toBe('30');
expect(customInputs.at(3).prop('value')).toBe('22');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

itIfFullICU('shows a given date in all inputs correctly given ISO string (24-hour format)', () => {
Expand All @@ -248,12 +248,12 @@ describe('DateTimeInput', () => {
const customInputs = component.find('input[type="number"]');

expect(nativeInput.prop('value')).toBe('2017-09-30T22:17:00');
expect(customInputs.at(0).prop('value')).toBe(2017);
expect(customInputs.at(1).prop('value')).toBe(9);
expect(customInputs.at(2).prop('value')).toBe(30);
expect(customInputs.at(3).prop('value')).toBe(22);
expect(customInputs.at(4).prop('value')).toBe(17);
expect(customInputs.at(5).prop('value')).toBe(0);
expect(customInputs.at(0).prop('value')).toBe('2017');
expect(customInputs.at(1).prop('value')).toBe('9');
expect(customInputs.at(2).prop('value')).toBe('30');
expect(customInputs.at(3).prop('value')).toBe('22');
expect(customInputs.at(4).prop('value')).toBe('17');
expect(customInputs.at(5).prop('value')).toBe('0');
});

it('shows empty value in all inputs correctly given null', () => {
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6713,9 +6713,9 @@ fsevents@^2.1.2:
languageName: node
linkType: hard

"react-date-picker@npm:^8.0.7":
version: 8.0.7
resolution: "react-date-picker@npm:8.0.7"
"react-date-picker@npm:^8.1.0":
version: 8.1.0
resolution: "react-date-picker@npm:8.1.0"
dependencies:
"@types/react-calendar": ^3.0.0
"@wojtekmaj/date-utils": ^1.0.3
Expand All @@ -6729,7 +6729,7 @@ fsevents@^2.1.2:
peerDependencies:
react: ^16.3.0 || ^17.0.0-0
react-dom: ^16.3.0 || ^17.0.0-0
checksum: 9b6aec0ba9016db5c42a8a537efd4e4761014674b4ff653e19a9c41f318d1eaa45d5caeb20d8d84ea076c994b84c6f10180c6686e96fb189224b5acb6fd360c0
checksum: b871f9ede4ebbdcf665824ed8fb9d85e14f72a40006913a2d17db9e06cbc1527363cfb7f837410764f225f5ffec89ed4b4e367446adee5ae6aba44276df25f1f
languageName: node
linkType: hard

Expand Down Expand Up @@ -6757,10 +6757,10 @@ fsevents@^2.1.2:
react: ^17.0.0
react-calendar: ^3.3.1
react-clock: ^3.0.0
react-date-picker: ^8.0.7
react-date-picker: ^8.1.0
react-dom: ^17.0.0
react-fit: ^1.0.3
react-time-picker: ^4.1.0
react-time-picker: ^4.2.0
rimraf: ^3.0.0
peerDependencies:
react: ^16.3.0 || ^17.0.0-0
Expand Down Expand Up @@ -6834,9 +6834,9 @@ fsevents@^2.1.2:
languageName: node
linkType: hard

"react-time-picker@npm:^4.1.0":
version: 4.1.2
resolution: "react-time-picker@npm:4.1.2"
"react-time-picker@npm:^4.2.0":
version: 4.2.0
resolution: "react-time-picker@npm:4.2.0"
dependencies:
"@wojtekmaj/date-utils": ^1.0.0
get-user-locale: ^1.2.0
Expand All @@ -6849,7 +6849,7 @@ fsevents@^2.1.2:
peerDependencies:
react: ^16.3.0 || ^17.0.0-0
react-dom: ^16.3.0 || ^17.0.0-0
checksum: 21477910650583b5678ff617ad18cafa8ba002959355cbfe25804fc4f7edf5a89609eb42c9e5bc49b20c4725d21c5774b39a1f90d3ec3018ccb3a01851f20e9a
checksum: cb6d41c1116708e4340bda06f512060276ceb26b65be808f8c7999e7635cc16e04aa4b02fd70c0ae09c2fbc589aebbcbfcd74cff98881354305b4f666646a3e1
languageName: node
linkType: hard

Expand Down

0 comments on commit 826849e

Please sign in to comment.