Skip to content

Commit fc76c7f

Browse files
committed
[update] add a section for setWorkTime settings for the night shift
1 parent 4a67db9 commit fc76c7f

File tree

2 files changed

+64
-12
lines changed

2 files changed

+64
-12
lines changed

data/api/gantt_setworktime.md

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,6 @@ The default working time is the following:
5757

5858
The method is used to alter the default settings.
5959

60-
<br>
61-
62-
Note, each next call of the method for the same date will re-write the previous working-time rule:
63-
64-
~~~js
65-
gantt.setWorkTime({hours:["8:00-12:00"]});
66-
gantt.setWorkTime({hours:["13:00-17:00"]});
67-
//the result of following commands will be the working time 13:00-17:00
68-
//and not a mixin of both commands
69-
~~~
70-
7160
Configuration object properties
7261
---------------------------------------
7362

@@ -152,6 +141,41 @@ gantt.setWorkTime({
152141
</tbody>
153142
</table>
154143

144+
### Setting working time hours for the night shift
145+
146+
Working time settings for the **hours** attribute of the [setWorkTime](api/gantt_setworktime.md) method' config object should be specified from
147+
the lesser interval to the greater one, that is in the ascending order. In case time settings are provided in the descending order, part of them
148+
will be ignored. In the example below the time intervals after `18:00` will be ignored:
149+
150+
~~~js
151+
// the settings below are incorrect
152+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00", "14:00-15:00", "08:00-10:00"]});
153+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00", "00:00-04:00", "05:00-06:00"]});
154+
~~~
155+
156+
If you need to specify working time settings for the night shift, you should set them in the following way:
157+
158+
- within 24 hours for the first day
159+
- within 24 hours for the following day
160+
161+
For example:
162+
163+
~~~js
164+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00"]});
165+
gantt.setWorkTime({day : 6, hours : ["00:00-04:00", "05:00-06:00"]});
166+
~~~
167+
168+
###Re-writing a working time rule
169+
170+
Note, each next call of the method for the same date will re-write the previous working-time rule:
171+
172+
~~~js
173+
gantt.setWorkTime({hours:["8:00-12:00"]});
174+
gantt.setWorkTime({hours:["13:00-17:00"]});
175+
//the result of the above commands will be the working time 13:00-17:00
176+
//and not a mixin of both commands
177+
~~~
178+
155179

156180
@changelog:
157181
- the **customWeeks** property is added in v7.1;

data/desktop/working_time.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,32 @@ gantt.setWorkTime({date:new Date(2019,0,1), hours:false})
175175
09_worktime/04_custom_workday_duration.html
176176
}}
177177

178+
### Setting working time hours for the night shift
179+
180+
Working time settings for the **hours** attribute of the [setWorkTime](api/gantt_setworktime.md) method' config object should be specified from
181+
the lesser interval to the greater one, that is in the ascending order. In case time settings are provided in the descending order, part of them
182+
will be ignored. In the example below the time intervals after `18:00` will be ignored:
183+
184+
~~~js
185+
// the settings below are incorrect
186+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00", "14:00-15:00", "08:00-10:00"]});
187+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00", "00:00-04:00", "05:00-06:00"]});
188+
~~~
189+
190+
If you need to specify working time settings for the night shift, you should set them in the following way:
191+
192+
- within 24 hours for the first day
193+
- within 24 hours for the following day
194+
195+
For example:
196+
197+
~~~js
198+
gantt.setWorkTime({day : 5, hours : ["16:00-18:00"]});
199+
gantt.setWorkTime({day : 6, hours : ["00:00-04:00", "05:00-06:00"]});
200+
~~~
201+
202+
### Configuring working time rules
203+
178204
There is the ability to configure different working time rules for different periods of time by using the **customWeeks** attribute of the [setWorkTime](api/gantt_setworktime.md) method. For instance, you can change the default working time for winter months:
179205

180206
~~~js
@@ -211,12 +237,14 @@ gantt.setWorkTime({hours:[9, 18]})
211237
}}
212238

213239

240+
### Re-writing a working time rule
241+
214242
Note, each next call of the method for the same date will re-write the previous working-time rule. So, if you need to unset some rule, call the api/gantt_setworktime.md method with other configuration:
215243

216244
~~~js
217245
gantt.setWorkTime({hours:["8:00-12:00"]});
218246
gantt.setWorkTime({hours:["13:00-17:00"]});
219-
//the result of following commands will be the working time 13:00-17:00
247+
//the result of the above commands will be the working time 13:00-17:00
220248
//and not a mixin of both commands
221249
~~~
222250

0 commit comments

Comments
 (0)