scheduler-node-models 1.1.2 → 1.1.3

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": "scheduler-node-models",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -308,6 +308,13 @@ export declare class Employee implements IEmployee {
308
308
  * @returns numeric (float) value for the total leave hours for the period
309
309
  */
310
310
  getLeaveHours(start: Date, end: Date): number;
311
+ /**
312
+ * This function will provide a leave workday with the number of total hours of leave
313
+ * time.
314
+ * @param start The date object for the date to check against
315
+ * @returns A workday object with the leave and hours for the date.
316
+ */
317
+ getLeave(start: Date): Workday;
311
318
  /**
312
319
  * This function will provide a total number of vacation/PTO leave hours for a
313
320
  * particular period of time (Actual Leave Only)
@@ -1080,6 +1080,32 @@ class Employee {
1080
1080
  });
1081
1081
  return answer;
1082
1082
  }
1083
+ /**
1084
+ * This function will provide a leave workday with the number of total hours of leave
1085
+ * time.
1086
+ * @param start The date object for the date to check against
1087
+ * @returns A workday object with the leave and hours for the date.
1088
+ */
1089
+ getLeave(start) {
1090
+ const workday = new workday_1.Workday();
1091
+ this.leaves.forEach(lv => {
1092
+ if (lv.leavedate.getUTCFullYear() === start.getUTCFullYear()
1093
+ && lv.leavedate.getUTCMonth() === start.getUTCMonth()
1094
+ && lv.leavedate.getUTCDate() === start.getUTCDate()) {
1095
+ if (workday.code === '') {
1096
+ workday.code = lv.code;
1097
+ workday.hours = lv.hours;
1098
+ }
1099
+ else {
1100
+ if (workday.hours < lv.hours) {
1101
+ workday.code = lv.code;
1102
+ workday.hours += lv.hours;
1103
+ }
1104
+ }
1105
+ }
1106
+ });
1107
+ return workday;
1108
+ }
1083
1109
  /**
1084
1110
  * This function will provide a total number of vacation/PTO leave hours for a
1085
1111
  * particular period of time (Actual Leave Only)