react-datetime-picker
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -140,3 +140,6 @@ 'use strict'; | ||
_this.setState(function (prevState) { | ||
return { isCalendarOpen: !prevState.isCalendarOpen }; | ||
return { | ||
isCalendarOpen: !prevState.isCalendarOpen, | ||
isClockOpen: false | ||
}; | ||
}); | ||
@@ -143,0 +146,0 @@ }, _this.stopPropagation = function (event) { |
{ | ||
"name": "react-datetime-picker", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "A date range picker for your React app.", | ||
@@ -5,0 +5,0 @@ "main": "dist/entry.js", |
@@ -36,3 +36,3 @@ ![downloads](https://img.shields.io/npm/dt/react-datetime-picker.svg) ![build](https://img.shields.io/travis/wojtekmaj/react-datetime-picker/master.svg) ![dependencies](https://img.shields.io/david/wojtekmaj/react-datetime-picker.svg | ||
|>16.0|latest| | ||
|>15.0|1.0.1| | ||
|>15.5|1.0.1| | ||
@@ -39,0 +39,0 @@ [React-Calendar](https://github.com/wojtekmaj/react-calendar), on which React-DateTime-Picker relies heavily, uses modern web technologies. That's why it's so fast, lightweight and easy to style. This, however, comes at a cost of [supporting only modern browsers](https://caniuse.com/#feat=internationalization). |
@@ -242,2 +242,20 @@ import React from 'react'; | ||
}); | ||
it('closes Clock when Calendar is opened by a click on the calendar icon', () => { | ||
const component = mount( | ||
<DateTimePicker isClockOpen /> | ||
); | ||
const clock = component.find('Clock'); | ||
const button = component.find('button.react-datetime-picker__calendar-button'); | ||
expect(clock).toHaveLength(1); | ||
button.simulate('click'); | ||
component.update(); | ||
const clock2 = component.find('Clock'); | ||
expect(clock2).toHaveLength(1); | ||
}); | ||
}); |
@@ -128,3 +128,6 @@ import React, { PureComponent } from 'react'; | ||
toggleCalendar = () => { | ||
this.setState(prevState => ({ isCalendarOpen: !prevState.isCalendarOpen })); | ||
this.setState(prevState => ({ | ||
isCalendarOpen: !prevState.isCalendarOpen, | ||
isClockOpen: false, | ||
})); | ||
} | ||
@@ -131,0 +134,0 @@ |
@@ -6,2 +6,14 @@ import { | ||
const hasFullICU = (() => { | ||
try { | ||
const date = new Date(2018, 0, 1, 21); | ||
const formatter = new Intl.DateTimeFormat('de-DE', { hour: 'numeric' }); | ||
return formatter.format(date) === '21'; | ||
} catch (err) { | ||
return false; | ||
} | ||
})(); | ||
const itIfFullICU = hasFullICU ? it : it.skip; | ||
describe('formatDate', () => { | ||
@@ -18,3 +30,3 @@ it('returns proper full numeric date', () => { | ||
describe('formatTime', () => { | ||
it('returns proper full time', () => { | ||
it('returns proper full time (12-hour format)', () => { | ||
const date = new Date(2017, 1, 1, 13, 27); | ||
@@ -26,2 +38,10 @@ | ||
}); | ||
itIfFullICU('returns proper full time (24-hour format)', () => { | ||
const date = new Date(2017, 1, 1, 13, 27); | ||
const formattedTime = formatTime(date, 'de-DE'); | ||
expect(formattedTime).toBe('13:27:00'); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100742
2395