hvp-shared 6.68.0 → 6.69.0

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.
@@ -49,5 +49,12 @@ export declare const MONTH_WORK_DAYS: number;
49
49
  export declare const DAILY_WORK_HOURS = 8;
50
50
  /** Working days in a week (alias for clarity) */
51
51
  export declare const WEEK_WORK_DAYS = 6;
52
- /** Calculate hourly rate from monthly fixed income: income / 30 / 8 */
52
+ /** Weeks per month (52 / 12 4.333) used for hourly rate calculation */
53
+ export declare const WEEKS_PER_MONTH: number;
54
+ /**
55
+ * Calculate hourly rate from monthly fixed income.
56
+ * Formula: income / (52/12) / 48
57
+ * Divides by work-weeks per month and max weekly hours (48).
58
+ * Hourly workers are NOT paid for rest days, so we use actual work hours, not calendar days.
59
+ */
53
60
  export declare function calculateHourlyRate(jobFixedIncome: number): number;
@@ -11,7 +11,7 @@
11
11
  * - Derived/calculated (computed from other constants)
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.WEEK_WORK_DAYS = exports.DAILY_WORK_HOURS = exports.MONTH_WORK_DAYS = exports.MONTH_DAYS = exports.WEEKS_IN_MONTH = exports.AVERAGE_WORK_DAYS_PER_MONTH = exports.EXCELLENCE_BONUS_RATE = exports.EXCELLENCE_BONUS_MIN_CLOSINGS = exports.DEDUCTION_INVALID_WITHDRAWAL = exports.DEDUCTION_INVALID_CLOSING = exports.BONUS_PER_CLOSING = exports.BONUS_SMALL_CLOSING = exports.BONUS_LARGE_CLOSING = exports.CLOSING_LARGE_THRESHOLD = exports.COMMISSION_SENIORITY_BONUS_PER_SEMESTER = exports.COMMISSION_PERCENTAGE_FOR_YEAR_END_BONUS = exports.YEAR_END_BONUS_DAYS = exports.ANNUAL_RAISE_PERCENT = exports.WORKING_DAYS_IN_A_WEEK = exports.MAX_DOUBLE_PLAY_WORK_WEEK_LIMIT = exports.MAX_WORK_WEEK_LIMIT = exports.HOLIDAY_OR_REST_EXTRA_PAY_PERCENTAGE = exports.SUNDAY_BONUS_PERCENTAGE = exports.VACATION_BONUS_PERCENTAGE = void 0;
14
+ exports.WEEKS_PER_MONTH = exports.WEEK_WORK_DAYS = exports.DAILY_WORK_HOURS = exports.MONTH_WORK_DAYS = exports.MONTH_DAYS = exports.WEEKS_IN_MONTH = exports.AVERAGE_WORK_DAYS_PER_MONTH = exports.EXCELLENCE_BONUS_RATE = exports.EXCELLENCE_BONUS_MIN_CLOSINGS = exports.DEDUCTION_INVALID_WITHDRAWAL = exports.DEDUCTION_INVALID_CLOSING = exports.BONUS_PER_CLOSING = exports.BONUS_SMALL_CLOSING = exports.BONUS_LARGE_CLOSING = exports.CLOSING_LARGE_THRESHOLD = exports.COMMISSION_SENIORITY_BONUS_PER_SEMESTER = exports.COMMISSION_PERCENTAGE_FOR_YEAR_END_BONUS = exports.YEAR_END_BONUS_DAYS = exports.ANNUAL_RAISE_PERCENT = exports.WORKING_DAYS_IN_A_WEEK = exports.MAX_DOUBLE_PLAY_WORK_WEEK_LIMIT = exports.MAX_WORK_WEEK_LIMIT = exports.HOLIDAY_OR_REST_EXTRA_PAY_PERCENTAGE = exports.SUNDAY_BONUS_PERCENTAGE = exports.VACATION_BONUS_PERCENTAGE = void 0;
15
15
  exports.calculateHourlyRate = calculateHourlyRate;
16
16
  // ── Mexican Labor Law (not configurable) ──
17
17
  /** Prima vacacional: 25% of vacation days' salary (Art. 80 LFT) */
@@ -61,9 +61,16 @@ exports.DAILY_WORK_HOURS = 8;
61
61
  /** Working days in a week (alias for clarity) */
62
62
  exports.WEEK_WORK_DAYS = 6;
63
63
  // ── Utility Functions ──
64
- /** Calculate hourly rate from monthly fixed income: income / 30 / 8 */
64
+ /** Weeks per month (52 / 12 4.333) used for hourly rate calculation */
65
+ exports.WEEKS_PER_MONTH = 52 / 12;
66
+ /**
67
+ * Calculate hourly rate from monthly fixed income.
68
+ * Formula: income / (52/12) / 48
69
+ * Divides by work-weeks per month and max weekly hours (48).
70
+ * Hourly workers are NOT paid for rest days, so we use actual work hours, not calendar days.
71
+ */
65
72
  function calculateHourlyRate(jobFixedIncome) {
66
73
  if (!jobFixedIncome || jobFixedIncome <= 0)
67
74
  return 0;
68
- return Math.round((jobFixedIncome / exports.MONTH_DAYS / exports.DAILY_WORK_HOURS) * 100) / 100;
75
+ return Math.round((jobFixedIncome / exports.WEEKS_PER_MONTH / exports.MAX_WORK_WEEK_LIMIT) * 100) / 100;
69
76
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hvp-shared",
3
- "version": "6.68.0",
3
+ "version": "6.69.0",
4
4
  "description": "Shared types and utilities for HVP backend and frontend",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",