@magic-xpa/engine 4.1300.0-dev4130.183 → 4.1300.0-dev4130.185

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,12 +1,12 @@
1
1
  {
2
2
  "name": "@magic-xpa/engine",
3
- "version": "4.1300.0-dev4130.183",
3
+ "version": "4.1300.0-dev4130.185",
4
4
  "description": "magic engine package",
5
5
  "license": "SEE LICENSE IN EULA.pdf",
6
6
  "dependencies": {
7
- "@magic-xpa/mscorelib": "4.1300.0-dev4130.183",
8
- "@magic-xpa/utils": "4.1300.0-dev4130.183",
9
- "@magic-xpa/gui": "4.1300.0-dev4130.183",
7
+ "@magic-xpa/mscorelib": "4.1300.0-dev4130.185",
8
+ "@magic-xpa/utils": "4.1300.0-dev4130.185",
9
+ "@magic-xpa/gui": "4.1300.0-dev4130.185",
10
10
  "@angular/common": "^21.1.4",
11
11
  "socket.io": "^4.8.3",
12
12
  "socket.io-client": "^4.8.3",
@@ -3945,6 +3945,70 @@ declare class ExpressionEvaluator extends GuiExpressionEvaluator {
3945
3945
  private eval_op_time_brk;
3946
3946
  private eval_op_addDateTime;
3947
3947
  private eval_op_difdt;
3948
+ /**
3949
+ * Safely extracts date/time parts from a JS Date using Intl.DateTimeFormat.
3950
+ *
3951
+ * WHY: Native JS Date has known pitfalls — century year bug (year < 100 mapped to 1900+year),
3952
+ * silent leap year rollovers, DST gaps, and 0-based months. Intl.DateTimeFormat avoids all
3953
+ * of these by using the browser's IANA timezone database internally.
3954
+ *
3955
+ * Used by both eval_op_localToUTC and eval_op_utcToLocal as a single safe extraction point.
3956
+ *
3957
+ * @param date - A valid JS Date object
3958
+ * @param timeZone - IANA timezone string (e.g. 'Asia/Kolkata', 'UTC').
3959
+ * Defaults to browser's local timezone — correct for any user, any country.
3960
+ * @returns Parsed parts (month is 1-based) or null if date is invalid
3961
+ */
3962
+ private convertDateTimeParts;
3963
+ /**
3964
+ * Validates that a time value (in total seconds) is within a valid day range
3965
+ */
3966
+ private isValidTimeSec;
3967
+ /**
3968
+ * Splits total seconds since midnight into hours, minutes, seconds.
3969
+ * e.g. 3661 → { hours: 1, minutes: 1, seconds: 1 }
3970
+ */
3971
+ private splitTimeSec;
3972
+ /**
3973
+ * Writes a time (seconds) and date (Magic numeric) into their respective output fields.
3974
+ */
3975
+ private writeDateTimeToFields;
3976
+ /**
3977
+ * Converts local date/time to UTC and writes the result into output fields.
3978
+ *
3979
+ * Edge cases handled:
3980
+ * - Century years — setFullYear() avoids JS year < 100 bug
3981
+ * - Leap years — round-trip validation catches silent date rollovers
3982
+ * - DST gaps — Intl.DateTimeFormat resolves correctly per IANA tz rules
3983
+ * - DST ambiguity — Intl uses first occurrence consistently
3984
+ * - Cross-midnight — JS Date handles automatically
3985
+ * - Out-of-range — time < 0 or > 86399 explicitly rejected
3986
+ *
3987
+ * @param resVal - Output: Boolean result (true = success)
3988
+ * @param localTimeVal - Input: Local time as total seconds since midnight (Magic numeric)
3989
+ * @param localDateVal - Input: Local date as Magic numeric
3990
+ * @param utcTimeVar - Input: Field index for the UTC time output field
3991
+ * @param utcDateVar - Input: Field index for the UTC date output field
3992
+ */
3993
+ private eval_op_localToUTC;
3994
+ /**
3995
+ * Converts UTC date/time to local and writes the result into output fields.
3996
+ *
3997
+ * Edge cases handled:
3998
+ * - Century years — Date.UTC() does not have the year < 100 bug
3999
+ * - Leap years — round-trip validation catches silent date rollovers
4000
+ * - DST gaps — Intl.DateTimeFormat resolves to correct local time automatically
4001
+ * - DST ambiguity — Intl uses first occurrence consistently
4002
+ * - Cross-midnight — JS Date handles automatically
4003
+ * - Out-of-range — time < 0 or > 86399 explicitly rejected
4004
+ *
4005
+ * @param resVal - Output: Boolean result (true = success)
4006
+ * @param utcTimeVal - Input: UTC time as total seconds since midnight (Magic numeric)
4007
+ * @param utcDateVal - Input: UTC date as Magic numeric
4008
+ * @param localTimeVar - Input: Field index for the local time output field
4009
+ * @param localDateVar - Input: Field index for the local date output field
4010
+ */
4011
+ private eval_op_utcToLocal;
3948
4012
  private eval_op_ndow;
3949
4013
  private eval_op_nmonth;
3950
4014
  mul_add(num: NUM_TYPE, mul: number, add: number): NUM_TYPE;