@jetbrains/ring-ui 4.2.18 → 4.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -351,41 +351,3 @@ rangeWithCustomPlaceholders.storyName = 'range with customized placeholders';
351
351
  rangeWithCustomPlaceholders.parameters = {
352
352
  hermione: {skip: true}
353
353
  };
354
-
355
- export const withEmptyPlaceholder = () => {
356
- class DatePickerExample extends Component {
357
- state = {
358
- from: undefined,
359
- to: undefined
360
- };
361
-
362
- setRange = ({from, to}) => {
363
- this.setState({from, to});
364
- };
365
-
366
- render() {
367
- return (
368
- <div>
369
- <DatePicker
370
- from={this.state.from}
371
- to={this.state.to}
372
- onChange={this.setRange}
373
- fromPlaceholder=""
374
- toPlaceholder=""
375
- rangePlaceholder=""
376
- clear
377
- range
378
- />
379
- </div>
380
- );
381
- }
382
- }
383
-
384
- return <DatePickerExample/>;
385
- };
386
-
387
- withEmptyPlaceholder.storyName = 'range with empty placeholder';
388
- withEmptyPlaceholder.parameters = {
389
- hermione: {skip: true}
390
- };
391
-
@@ -3,8 +3,6 @@ import PropTypes from 'prop-types';
3
3
  import addMonths from 'date-fns/addMonths';
4
4
  import getDay from 'date-fns/getDay';
5
5
  import getDaysInMonth from 'date-fns/getDaysInMonth';
6
- import set from 'date-fns/set';
7
- import startOfHour from 'date-fns/startOfHour';
8
6
  import startOfMonth from 'date-fns/startOfMonth';
9
7
  import subMonths from 'date-fns/subMonths';
10
8
  import endOfMonth from 'date-fns/endOfMonth';
@@ -46,8 +44,9 @@ const scrollSchedule = scheduleRAF();
46
44
  let dy = 0;
47
45
  export default function Months(props) {
48
46
  const {scrollDate} = props;
49
- // prevent switching from april to march because of daylight saving time
50
- const monthStart = startOfHour(set(scrollDate, {date: 1, hours: 1}));
47
+ const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate);
48
+ // Creating midnight of the first day of the month in UTC to prevent the impact of user timezone
49
+ const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
51
50
 
52
51
  let month = subMonths(monthStart, MONTHSBACK);
53
52
  const months = [month];
@@ -1013,15 +1013,6 @@ export const multipleWithLimit = args => <Select {...args}/>;
1013
1013
  multipleWithLimit.storyName = 'multiple with limit';
1014
1014
  multipleWithLimit.parameters = {hermione: {skip: true}};
1015
1015
 
1016
- export const withEmptyPlaceholder = args => (
1017
- <Select
1018
- {...args}
1019
- label={''}
1020
- />
1021
- );
1022
-
1023
- withEmptyPlaceholder.storyName = 'with empty placeholder';
1024
- withEmptyPlaceholder.parameters = {hermione: {skip: true}};
1025
1016
 
1026
1017
  export const selectInPopup = args => (
1027
1018
  <Dropdown
@@ -47,7 +47,6 @@ import './months.js';
47
47
  import 'date-fns/addMonths';
48
48
  import 'date-fns/getDay';
49
49
  import 'date-fns/getDaysInMonth';
50
- import 'date-fns/startOfHour';
51
50
  import 'date-fns/startOfMonth';
52
51
  import 'date-fns/subMonths';
53
52
  import 'date-fns/endOfMonth';
@@ -35,8 +35,6 @@ import 'date-fns/add';
35
35
  import 'date-fns/addMonths';
36
36
  import 'date-fns/getDay';
37
37
  import 'date-fns/getDaysInMonth';
38
- import 'date-fns/set';
39
- import 'date-fns/startOfHour';
40
38
  import 'date-fns/startOfMonth';
41
39
  import 'date-fns/subMonths';
42
40
  import 'date-fns/endOfMonth';
@@ -51,6 +49,7 @@ import 'date-fns/getDate';
51
49
  import 'date-fns/isToday';
52
50
  import './month-names.js';
53
51
  import 'date-fns/isThisMonth';
52
+ import 'date-fns/set';
54
53
  import 'date-fns/startOfYear';
55
54
  import './month-slider.js';
56
55
  import 'date-fns/addYears';
@@ -4,8 +4,6 @@ import PropTypes from 'prop-types';
4
4
  import addMonths from 'date-fns/addMonths';
5
5
  import getDay from 'date-fns/getDay';
6
6
  import getDaysInMonth from 'date-fns/getDaysInMonth';
7
- import set from 'date-fns/set';
8
- import startOfHour from 'date-fns/startOfHour';
9
7
  import startOfMonth from 'date-fns/startOfMonth';
10
8
  import subMonths from 'date-fns/subMonths';
11
9
  import endOfMonth from 'date-fns/endOfMonth';
@@ -28,6 +26,7 @@ import 'date-fns/isSameDay';
28
26
  import 'date-fns/isToday';
29
27
  import 'date-fns/startOfDay';
30
28
  import 'date-fns/isThisMonth';
29
+ import 'date-fns/set';
31
30
  import 'date-fns/startOfYear';
32
31
  import './month-slider.js';
33
32
  import 'date-fns/addYears';
@@ -65,12 +64,10 @@ let dy = 0;
65
64
  function Months(props) {
66
65
  const {
67
66
  scrollDate
68
- } = props; // prevent switching from april to march because of daylight saving time
67
+ } = props;
68
+ const monthDate = scrollDate instanceof Date ? scrollDate : new Date(scrollDate); // Creating midnight of the first day of the month in UTC to prevent the impact of user timezone
69
69
 
70
- const monthStart = startOfHour(set(scrollDate, {
71
- date: 1,
72
- hours: 1
73
- }));
70
+ const monthStart = new Date(Date.UTC(monthDate.getFullYear(), monthDate.getMonth(), 1));
74
71
  let month = subMonths(monthStart, MONTHSBACK);
75
72
  const months = [month];
76
73
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetbrains/ring-ui",
3
- "version": "4.2.18",
3
+ "version": "4.2.19",
4
4
  "description": "JetBrains UI library",
5
5
  "author": "JetBrains",
6
6
  "license": "Apache-2.0",
@@ -221,5 +221,5 @@
221
221
  "node": ">=7.4",
222
222
  "npm": ">=6.0.0"
223
223
  },
224
- "gitHead": "6b6f519b3990ff308b592a9b9fe42891c2591166"
224
+ "gitHead": "3e4b569bf8d13582ab9502779338b81eb737cd3e"
225
225
  }