@bytebrand/fe-ui-core 4.2.13 → 4.2.15

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core",
3
- "version": "4.2.13",
3
+ "version": "4.2.15",
4
4
  "description": "UI components for the auto.de project",
5
5
  "main": "index.ts",
6
6
  "module": "dist/common.js",
@@ -39,7 +39,7 @@ const TimePicker = ({
39
39
  };
40
40
 
41
41
  const endOfTheDayTime = currentDay > 5 || currentDay < 1 ? '17:30:00' : '19:30:00';
42
- const startOfTheDayTime = currentDay > 5 || currentDay < 1 ? '09:00:00' : '08:00:00';
42
+ const startOfTheDayTime = currentDay > 5 || currentDay < 1 ? '09:00:00' : '08:30:00';
43
43
  const setNewDay = new Date(`${date.toDateString()} ${endOfTheDayTime}`) > date ? 0 : 86400000;
44
44
  const interval = 30 * 60 * 1000;
45
45
  const roundedTime = new Date(Math.ceil(date / interval) * interval);
@@ -53,6 +53,10 @@ const TimePicker = ({
53
53
  const nextWeekDaysFull = [...Array(7).keys()].map(days => new Date(Date.now() + setNewDay + 86400000 * days));
54
54
  const currentDayFull = new Date(nextWeekDaysFull[0]).toDateString();
55
55
 
56
+ const currentTime = new Date(`${currentDayFull} ${new Date().toLocaleTimeString()}`);
57
+ const endOfTheDay = new Date(`${currentDayFull} ${endOfTheDayTime}`);
58
+ const startOfTheDay = new Date(`${currentDayFull} ${startOfTheDayTime}`);
59
+
56
60
  const isWorkingHours = () => (endOfTheDay > currentTime) && (startOfTheDay <= currentTime) && currentDay === new Date().getDay();
57
61
  const isAfterWorkingHours = () => endOfTheDay < currentTime;
58
62
 
@@ -61,10 +65,6 @@ const TimePicker = ({
61
65
  const dayRanges: { value: number, label: string, time: string }[] = [];
62
66
  const ammountRanges = currentDay > 5 || currentDay < 1 ? (ranges - (roundedTime.getHours() - 9)) : (ranges - (roundedTime.getHours() - 8));
63
67
 
64
- const currentTime = new Date(`${currentDayFull} ${new Date().toLocaleTimeString()}`);
65
- const endOfTheDay = new Date(`${currentDayFull} ${endOfTheDayTime}`);
66
- const startOfTheDay = new Date(`${currentDayFull} ${startOfTheDayTime}`);
67
-
68
68
  const startTime = (currentDay > 5) || (currentDay < 1) ? 9 : 8;
69
69
 
70
70
  const getTimeRanges = () => {
@@ -76,7 +76,9 @@ const TimePicker = ({
76
76
  currentDayRanges.push({ time, value: currentDayRanges.length, label: `${time} - ${rangeTime}` });
77
77
  } // time ranges for current day and from current time
78
78
 
79
- for (let minutes = 0; minutes < ranges * 60; minutes = minutes + 30) {
79
+ const startOfTheDayMinutes = currentDay > 5 || currentDay < 1 ? 0 : 30; // from monday to friday we need to start from 08:30:00
80
+
81
+ for (let minutes = startOfTheDayMinutes; minutes < ranges * 60; minutes = minutes + 30) {
80
82
  date.setHours(startTime);
81
83
  date.setMinutes(minutes);
82
84
  const time = date.toLocaleTimeString('de', format);
@@ -98,6 +100,13 @@ const TimePicker = ({
98
100
  [day, time]
99
101
  );
100
102
 
103
+ useEffect(
104
+ () => {
105
+ onHandleTimestampChange(+new Date(`${new Date(nextWeekDaysFull[day]).toDateString()} ${getTimeRanges()[time].time}`) / 1000);
106
+ },
107
+ [currentDay]
108
+ );
109
+
101
110
  const getHours = (time: string) => {
102
111
  const date = new Date(`${new Date().toDateString()}, ${time}:00`);
103
112
  return date;