ssjs-data 0.3.5 → 0.4.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.
package/README.md CHANGED
@@ -88,6 +88,7 @@ import {
88
88
  TRIGGERED_SEND_TRACKING_CLICKS_METHODS,
89
89
  TRIGGERED_SEND_TRACKING_TOTAL_BY_INTERVAL_METHODS,
90
90
  // DateTime / ErrorUtil
91
+ DATE_TIME_METHODS,
91
92
  DATE_TIME_TIMEZONE_METHODS,
92
93
  ERROR_UTIL_METHODS,
93
94
  // Script.Util
@@ -299,6 +300,19 @@ if (attributeMethodNames.has('getvalue')) { /* ... */ }
299
300
  const m = attributeMethodLookup.get('getvalue');
300
301
  ```
301
302
 
303
+ ### `DATE_TIME_METHODS`
304
+
305
+ `DateTime` namespace methods for date conversion between local and system (UTC) time. These require `Platform.Load("core", "1")`:
306
+
307
+ ```js
308
+ import { DATE_TIME_METHODS } from 'ssjs-data';
309
+
310
+ for (const method of DATE_TIME_METHODS) {
311
+ console.log(method.name); // e.g. 'SystemDateToLocalDate', 'LocalDateToSystemDate'
312
+ console.log(method.syntax); // e.g. 'DateTime.SystemDateToLocalDate(dateString)'
313
+ }
314
+ ```
315
+
302
316
  ### `DATE_TIME_TIMEZONE_METHODS`
303
317
 
304
318
  Methods on the `DateTime.TimeZone` namespace (requires `Platform.Load("core", "1.1.5")`):
@@ -18,6 +18,12 @@ declare namespace Platform {
18
18
  * var rows = de.Rows.Retrieve();
19
19
  */
20
20
  function Load(libraryName: string, version: string): void;
21
+ /**
22
+ * SFMC Platform function API.
23
+ *
24
+ * [ssjs.guide reference](https://ssjs.guide/platform-functions/)
25
+ *
26
+ */
21
27
  namespace Function {
22
28
  /**
23
29
  * Retrieves a single field value from a Data Extension row matching filter criteria. To filter by multiple columns, pass string arrays for whereFieldNames and whereFieldValues (AND logic).
@@ -307,25 +313,25 @@ declare namespace Platform {
307
313
  *
308
314
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
309
315
  *
310
- * @param dateValue - Date-time string in system time (CST)
316
+ * @param dateString - Date-time string in system time (CST)
311
317
  * @example
312
318
  * var systemDate = Platform.Function.Now();
313
319
  * var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
314
320
  * Write(localDate);
315
321
  */
316
- function SystemDateToLocalDate(dateValue: string): string;
322
+ function SystemDateToLocalDate(dateString: string): string;
317
323
  /**
318
324
  * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
319
325
  *
320
326
  * [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
321
327
  *
322
- * @param dateValue - Date-time string in local account/user time
328
+ * @param dateString - Date-time string in local account/user time
323
329
  * @example
324
330
  * var localDate = "8/5/2025 12:00:00 PM";
325
331
  * var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
326
332
  * Write(systemDate);
327
333
  */
328
- function LocalDateToSystemDate(dateValue: string): string;
334
+ function LocalDateToSystemDate(dateString: string): string;
329
335
  /**
330
336
  * Raises an error with an optional scope flag. When the second parameter is true, the error stops only the current recipient's send. When false, the error halts the entire send job.
331
337
  *
@@ -746,6 +752,12 @@ declare namespace Platform {
746
752
  */
747
753
  function IsCHTMLBrowser(userAgentString: string): boolean;
748
754
  }
755
+ /**
756
+ * SSJS variable declaration and retrieval methods.
757
+ *
758
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-variable/)
759
+ *
760
+ */
749
761
  namespace Variable {
750
762
  /**
751
763
  * Retrieves the value of an AMPscript variable from the SSJS context.
@@ -773,6 +785,12 @@ declare namespace Platform {
773
785
  */
774
786
  function SetValue(variableName: string, value: string): void;
775
787
  }
788
+ /**
789
+ * HTTP response manipulation methods.
790
+ *
791
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-response/)
792
+ *
793
+ */
776
794
  namespace Response {
777
795
  /**
778
796
  * Sets a response header on the current page response.
@@ -844,6 +862,12 @@ declare namespace Platform {
844
862
  var ContentType: string;
845
863
  var CharacterSet: string;
846
864
  }
865
+ /**
866
+ * HTTP request reading methods and properties.
867
+ *
868
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-request/)
869
+ *
870
+ */
847
871
  namespace Request {
848
872
  /**
849
873
  * Retrieves the value of a URL query string parameter.
@@ -922,6 +946,12 @@ declare namespace Platform {
922
946
  const RequestURL: string;
923
947
  const UserAgent: string;
924
948
  }
949
+ /**
950
+ * Methods to access subscriber and recipient data.
951
+ *
952
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/platform-recipient/)
953
+ *
954
+ */
925
955
  namespace Recipient {
926
956
  /**
927
957
  * Returns the value of a subscriber attribute or sendable data extension field for the current recipient.
@@ -1278,32 +1308,6 @@ declare function EndImpressionRegion(closeAll?: boolean): void;
1278
1308
  * var sendTime = Platform.Function.Now(true);
1279
1309
  */
1280
1310
  declare function Now(useContextTime?: boolean): string;
1281
- /**
1282
- * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
1283
- *
1284
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/systemdatetolocaldate/)
1285
- *
1286
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1287
- * @param dateValue - Date-time string in system time (CST)
1288
- * @example
1289
- * var systemDate = Platform.Function.Now();
1290
- * var localDate = Platform.Function.SystemDateToLocalDate(systemDate);
1291
- * Write(localDate);
1292
- */
1293
- declare function SystemDateToLocalDate(dateValue: string): string;
1294
- /**
1295
- * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
1296
- *
1297
- * [ssjs.guide reference](https://ssjs.guide/platform-functions/localdatetosystemdate/)
1298
- *
1299
- * @remarks Requires `Platform.Load("Core", "1")` before use.
1300
- * @param dateValue - Date-time string in local account/user time
1301
- * @example
1302
- * var localDate = "8/5/2025 12:00:00 PM";
1303
- * var systemDate = Platform.Function.LocalDateToSystemDate(localDate);
1304
- * Write(systemDate);
1305
- */
1306
- declare function LocalDateToSystemDate(dateValue: string): string;
1307
1311
  /**
1308
1312
  * Redirects the current page to a new URL. Pass false for a 302 temporary redirect or true for a 301 permanent redirect. Do not use 301 if you want browsers to re-check the original URL later.
1309
1313
  *
@@ -1402,6 +1406,8 @@ interface DataExtensionFields {
1402
1406
  /**
1403
1407
  * Adds a field to the previously initialized data extension. `properties.Name` is required; the rest (`CustomerKey`, `FieldType`, `MaxLength`, `IsRequired`, `IsPrimaryKey`, `Ordinal`, `Scale`, `DefaultValue`) are optional. `FieldType` accepts: 'Boolean', 'Date', 'Decimal', 'EmailAddress', 'Locale', 'Number', 'Phone', 'Text'.
1404
1408
  *
1409
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1410
+ *
1405
1411
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1406
1412
  * @param properties - Object describing the new field.
1407
1413
  * @returns Returns "OK" on success or throws on failure.
@@ -1415,6 +1421,8 @@ interface DataExtensionFields {
1415
1421
  /**
1416
1422
  * Returns an array of field definitions for the previously initialized data extension.
1417
1423
  *
1424
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1425
+ *
1418
1426
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1419
1427
  * @returns List of field-definition objects.
1420
1428
  * @example
@@ -1426,6 +1434,8 @@ interface DataExtensionFields {
1426
1434
  /**
1427
1435
  * Updates which data extension field is used to relate the data extension to the All Subscribers list during sending. Pass the name of the data extension field, and which subscriber attribute it should map to.
1428
1436
  *
1437
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-fields/)
1438
+ *
1429
1439
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1430
1440
  * @param deFieldName - Name of the data extension field that should make the connection to the subscriber list.
1431
1441
  * @param subscriberField - Subscriber attribute to map the data extension field to.
@@ -1441,6 +1451,8 @@ interface DataExtensionRows {
1441
1451
  /**
1442
1452
  * Adds one or more rows to the previously initialized data extension.
1443
1453
  *
1454
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1455
+ *
1444
1456
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1445
1457
  * @param rowData - Array of objects, one per row to add. Each object's keys must match data extension field names.
1446
1458
  * @returns Returns "OK" on success or throws on failure.
@@ -1457,6 +1469,8 @@ interface DataExtensionRows {
1457
1469
  /**
1458
1470
  * Returns rows where the specified columns equal the specified values (AND-joined). Optionally limits results and orders by a field. When initializing a data extension for `Lookup()` from an email message, you must use the data extension Name; on landing pages, either Name or external key works — make them identical to be safe.
1459
1471
  *
1472
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1473
+ *
1460
1474
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1461
1475
  * @param searchFieldNames - Array of column names to match against.
1462
1476
  * @param searchValues - Array of values to match (one per column, in order).
@@ -1472,6 +1486,8 @@ interface DataExtensionRows {
1472
1486
  /**
1473
1487
  * Deletes rows from the previously initialized data extension where the specified columns equal the specified values (AND-joined). For large deletion requests, batch the work — this method times out on long-running deletes.
1474
1488
  *
1489
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1490
+ *
1475
1491
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1476
1492
  * @param columnNames - Array of column names to match against.
1477
1493
  * @param columnValues - Array of values to match (one per column, in order).
@@ -1485,6 +1501,8 @@ interface DataExtensionRows {
1485
1501
  /**
1486
1502
  * Retrieves up to 2500 rows from the previously initialized data extension. When called without a filter, returns all rows (subject to the 2500-row cap). Cannot be used in the context of an email message or email preview.
1487
1503
  *
1504
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1505
+ *
1488
1506
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1489
1507
  * @param filter - WSProxy-style filter object — simple `{Property, SimpleOperator, Value}` or compound with `LeftOperand`/`LogicalOperator`/`RightOperand`. Optional per the example, despite the doc table marking `Required: Yes`.
1490
1508
  * @returns Rows from the data extension matching the filter (or all rows when no filter is supplied).
@@ -1499,6 +1517,8 @@ interface DataExtensionRows {
1499
1517
  /**
1500
1518
  * Updates the columns of rows where `whereFieldNames` equal `whereValues` (AND-joined). Throws if no row matches.
1501
1519
  *
1520
+ * [ssjs.guide reference](https://ssjs.guide/core-library/dataextension-rows/)
1521
+ *
1502
1522
  * @remarks Requires `Platform.Load("Core", "1")` before use.
1503
1523
  * @param rowData - Object whose keys are columns to update and values are the new values.
1504
1524
  * @param whereFieldNames - Array of column names to match against.
@@ -3369,11 +3389,37 @@ declare namespace DataExtension.Rows {
3369
3389
  */
3370
3390
  function Update(rowData: object, whereFieldNames: any[], whereValues: any[]): string;
3371
3391
  }
3392
+ declare namespace DateTime {
3393
+ /**
3394
+ * Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.
3395
+ *
3396
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3397
+ *
3398
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
3399
+ * @param dateString - Date-time string in system time (CST)
3400
+ * @example
3401
+ * var localTime = DateTime.SystemDateToLocalDate(Platform.Function.Now());
3402
+ * Write(localTime);
3403
+ */
3404
+ function SystemDateToLocalDate(dateString: string): string;
3405
+ /**
3406
+ * Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).
3407
+ *
3408
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3409
+ *
3410
+ * @remarks Requires `Platform.Load("Core", "1")` before use.
3411
+ * @param dateString - Date-time string in local account/user time
3412
+ * @example
3413
+ * var systemTime = DateTime.LocalDateToSystemDate("8/5/2025 12:34 PM");
3414
+ * Write(systemTime);
3415
+ */
3416
+ function LocalDateToSystemDate(dateString: string): string;
3417
+ }
3372
3418
  declare namespace DateTime.TimeZone {
3373
3419
  /**
3374
3420
  * Retrieves an array of time zones matching the specified filter criteria. If no filter is supplied the function returns all available time zones.
3375
3421
  *
3376
- * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime-timezone/)
3422
+ * [ssjs.guide reference](https://ssjs.guide/platform-objects/datetime/)
3377
3423
  *
3378
3424
  * @remarks Requires `Platform.Load("Core", "1")` before use.
3379
3425
  * @param filter - Filter criteria object with properties: `Property`, `SimpleOperator`, `Value`.
@@ -3627,7 +3673,33 @@ declare namespace HTTPHeader {
3627
3673
  // ── Script.Util ──────────────────────────────────────────────────────────────
3628
3674
  declare namespace Script {
3629
3675
  namespace Util {
3676
+ /**
3677
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3678
+ *
3679
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3680
+ *
3681
+ * @returns An authenticated WSProxy object bound to the current execution context.
3682
+ * @example
3683
+ * var api = new Script.Util.WSProxy();
3684
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3685
+ * if (result.Status === "OK") {
3686
+ * Write(Stringify(result.Results));
3687
+ * }
3688
+ */
3630
3689
  class WSProxy {
3690
+ /**
3691
+ * Creates a WSProxy instance for making SOAP API calls against the Marketing Cloud web service. No Platform.Load is required.
3692
+ *
3693
+ * [ssjs.guide reference](https://ssjs.guide/wsproxy/)
3694
+ *
3695
+ * @returns An authenticated WSProxy object bound to the current execution context.
3696
+ * @example
3697
+ * var api = new Script.Util.WSProxy();
3698
+ * var result = api.retrieve("DataExtension", ["Name", "CustomerKey"]);
3699
+ * if (result.Status === "OK") {
3700
+ * Write(Stringify(result.Results));
3701
+ * }
3702
+ */
3631
3703
  constructor();
3632
3704
  /**
3633
3705
  * Creates a new Marketing Cloud object via the SOAP API.
@@ -3877,7 +3949,45 @@ declare namespace Script {
3877
3949
  */
3878
3950
  deleteBatch(objectType: string, propertiesArray: any[]): object;
3879
3951
  }
3952
+ /**
3953
+ * Creates an HTTP request handler that supports any HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). Unlike Platform.Function.HTTPGet/HTTPPost, this handler supports custom methods and headers. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3954
+ *
3955
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3956
+ *
3957
+ * @param url - The destination URL for the request
3958
+ * @example
3959
+ * var url = "https://api.example.com/items/123";
3960
+ * var req = new Script.Util.HttpRequest(url);
3961
+ * req.emptyContentHandling = 0;
3962
+ * req.retries = 2;
3963
+ * req.continueOnError = true;
3964
+ * req.contentType = "application/json";
3965
+ * req.method = "PUT";
3966
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3967
+ * req.postData = Stringify({ status: "active" });
3968
+ * var resp = req.send();
3969
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3970
+ */
3880
3971
  class HttpRequest {
3972
+ /**
3973
+ * Creates an HTTP request handler that supports any HTTP method (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS). Unlike Platform.Function.HTTPGet/HTTPPost, this handler supports custom methods and headers. Call send() to execute the request and receive a Script.Util.HttpResponse object.
3974
+ *
3975
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httprequest/)
3976
+ *
3977
+ * @param url - The destination URL for the request
3978
+ * @example
3979
+ * var url = "https://api.example.com/items/123";
3980
+ * var req = new Script.Util.HttpRequest(url);
3981
+ * req.emptyContentHandling = 0;
3982
+ * req.retries = 2;
3983
+ * req.continueOnError = true;
3984
+ * req.contentType = "application/json";
3985
+ * req.method = "PUT";
3986
+ * req.setHeader("Authorization", "Bearer " + accessToken);
3987
+ * req.postData = Stringify({ status: "active" });
3988
+ * var resp = req.send();
3989
+ * var result = Platform.Function.ParseJSON(String(resp.content));
3990
+ */
3881
3991
  constructor(url: string);
3882
3992
  /**
3883
3993
  * Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().
@@ -3935,7 +4045,41 @@ declare namespace Script {
3935
4045
  */
3936
4046
  removeHeader(name: string): void;
3937
4047
  }
4048
+ /**
4049
+ * Creates an HTTP GET request handler. Unlike Platform.Function.HTTPGet, this handler caches content for use in mail sends and supports custom headers. Only works with HTTP on port 80 and HTTPS on port 443. Call send() to execute the request and receive a Script.Util.HttpResponse object.
4050
+ *
4051
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
4052
+ *
4053
+ * @param url - The URL to retrieve content from
4054
+ * @example
4055
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
4056
+ * req.setHeader("Authorization", "Bearer " + accessToken);
4057
+ * req.retries = 2;
4058
+ * req.continueOnError = true;
4059
+ * var resp = req.send();
4060
+ * if (resp.statusCode == 200) {
4061
+ * var result = Platform.Function.ParseJSON(String(resp.content));
4062
+ * Platform.Response.Write(Platform.Function.Stringify(result));
4063
+ * }
4064
+ */
3938
4065
  class HttpGet {
4066
+ /**
4067
+ * Creates an HTTP GET request handler. Unlike Platform.Function.HTTPGet, this handler caches content for use in mail sends and supports custom headers. Only works with HTTP on port 80 and HTTPS on port 443. Call send() to execute the request and receive a Script.Util.HttpResponse object.
4068
+ *
4069
+ * [ssjs.guide reference](https://ssjs.guide/http/script-util-httpget/)
4070
+ *
4071
+ * @param url - The URL to retrieve content from
4072
+ * @example
4073
+ * var req = new Script.Util.HttpGet("https://api.example.com/data");
4074
+ * req.setHeader("Authorization", "Bearer " + accessToken);
4075
+ * req.retries = 2;
4076
+ * req.continueOnError = true;
4077
+ * var resp = req.send();
4078
+ * if (resp.statusCode == 200) {
4079
+ * var result = Platform.Function.ParseJSON(String(resp.content));
4080
+ * Platform.Response.Write(Platform.Function.Stringify(result));
4081
+ * }
4082
+ */
3939
4083
  constructor(url: string);
3940
4084
  /**
3941
4085
  * Executes the HTTP request and returns a Script.Util.HttpResponse object. The response object has a `statusCode` property and a `content` property. Use String(resp.content) to convert the CLR content to a JavaScript string before parsing with Platform.Function.ParseJSON().
@@ -271,7 +271,7 @@
271
271
  "type": "function",
272
272
  "description": "Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.",
273
273
  "params": [
274
- "dateValue"
274
+ "dateString"
275
275
  ],
276
276
  "returnType": "string"
277
277
  },
@@ -282,7 +282,7 @@
282
282
  "type": "function",
283
283
  "description": "Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).",
284
284
  "params": [
285
- "dateValue"
285
+ "dateString"
286
286
  ],
287
287
  "returnType": "string"
288
288
  },
@@ -1220,9 +1220,31 @@
1220
1220
  ],
1221
1221
  "returnType": "string"
1222
1222
  },
1223
+ {
1224
+ "name": "DateTime.SystemDateToLocalDate",
1225
+ "url": "/platform-objects/datetime/",
1226
+ "section": "Platform Objects",
1227
+ "type": "method",
1228
+ "description": "Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.",
1229
+ "params": [
1230
+ "dateString"
1231
+ ],
1232
+ "returnType": "string"
1233
+ },
1234
+ {
1235
+ "name": "DateTime.LocalDateToSystemDate",
1236
+ "url": "/platform-objects/datetime/",
1237
+ "section": "Platform Objects",
1238
+ "type": "method",
1239
+ "description": "Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).",
1240
+ "params": [
1241
+ "dateString"
1242
+ ],
1243
+ "returnType": "string"
1244
+ },
1223
1245
  {
1224
1246
  "name": "DateTime.TimeZone.Retrieve",
1225
- "url": "/platform-objects/datetime-timezone/",
1247
+ "url": "/platform-objects/datetime/",
1226
1248
  "section": "Platform Objects",
1227
1249
  "type": "method",
1228
1250
  "description": "Retrieves an array of time zones matching the specified filter criteria.",
@@ -2898,7 +2920,7 @@
2898
2920
  },
2899
2921
  {
2900
2922
  "name": "DateTime.TimeZone",
2901
- "url": "/platform-objects/datetime-timezone/",
2923
+ "url": "/platform-objects/datetime/",
2902
2924
  "section": "Core Library",
2903
2925
  "type": "object",
2904
2926
  "description": "Time zone utilities for SSJS date/time conversions."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ssjs-data",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "Canonical SSJS (Server-Side JavaScript) function catalog, Core library objects, Platform methods, and globals for SFMC tooling",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -56,6 +56,12 @@
56
56
  "eslint-plugin-unicorn": "^64.0.0",
57
57
  "globals": "^17.4.0",
58
58
  "husky": "^9.1.7",
59
+ "lint-staged": "^17.0.5",
59
60
  "prettier": "^3.8.1"
61
+ },
62
+ "lint-staged": {
63
+ "*.{js,mjs,cjs}": [
64
+ "eslint --fix"
65
+ ]
60
66
  }
61
67
  }
package/src/index.js CHANGED
@@ -269,12 +269,12 @@ export const SSJS_GLOBALS = [
269
269
  },
270
270
  { name: 'Now', aliasOf: 'Platform.Function.Now', requiresCoreLoad: true },
271
271
  {
272
- name: 'SystemDateToLocalDate',
272
+ name: 'DateTime.SystemDateToLocalDate',
273
273
  aliasOf: 'Platform.Function.SystemDateToLocalDate',
274
274
  requiresCoreLoad: true,
275
275
  },
276
276
  {
277
- name: 'LocalDateToSystemDate',
277
+ name: 'DateTime.LocalDateToSystemDate',
278
278
  aliasOf: 'Platform.Function.LocalDateToSystemDate',
279
279
  requiresCoreLoad: true,
280
280
  },
@@ -1007,13 +1007,13 @@ export const PLATFORM_FUNCTIONS = [
1007
1007
  'Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.',
1008
1008
  params: [
1009
1009
  {
1010
- name: 'dateValue',
1010
+ name: 'dateString',
1011
1011
  description: 'Date-time string in system time (CST)',
1012
1012
  type: 'string',
1013
1013
  },
1014
1014
  ],
1015
1015
  returnType: 'string',
1016
- syntax: 'Platform.Function.SystemDateToLocalDate(dateValue)',
1016
+ syntax: 'Platform.Function.SystemDateToLocalDate(dateString)',
1017
1017
  example:
1018
1018
  'var systemDate = Platform.Function.Now();\nvar localDate = Platform.Function.SystemDateToLocalDate(systemDate);\nWrite(localDate);',
1019
1019
  },
@@ -1025,13 +1025,13 @@ export const PLATFORM_FUNCTIONS = [
1025
1025
  'Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).',
1026
1026
  params: [
1027
1027
  {
1028
- name: 'dateValue',
1028
+ name: 'dateString',
1029
1029
  description: 'Date-time string in local account/user time',
1030
1030
  type: 'string',
1031
1031
  },
1032
1032
  ],
1033
1033
  returnType: 'string',
1034
- syntax: 'Platform.Function.LocalDateToSystemDate(dateValue)',
1034
+ syntax: 'Platform.Function.LocalDateToSystemDate(dateString)',
1035
1035
  example:
1036
1036
  'var localDate = "8/5/2025 12:00:00 PM";\nvar systemDate = Platform.Function.LocalDateToSystemDate(localDate);\nWrite(systemDate);',
1037
1037
  },
@@ -6236,6 +6236,51 @@ export const ATTRIBUTE_METHODS = [
6236
6236
 
6237
6237
  export const attributeMethodNames = new Set(ATTRIBUTE_METHODS.map((m) => m.name.toLowerCase()));
6238
6238
 
6239
+ // ── DateTime methods ─────────────────────────────────────────────────────────
6240
+ // Short-form date-time conversion helpers on the DateTime namespace.
6241
+ // Require Platform.Load("core", "1.1.5").
6242
+
6243
+ export const DATE_TIME_METHODS = [
6244
+ {
6245
+ name: 'SystemDateToLocalDate',
6246
+ minArgs: 1,
6247
+ maxArgs: 1,
6248
+ description:
6249
+ 'Converts a date-time value from Marketing Cloud system time (CST) to the local time of the account or user.',
6250
+ params: [
6251
+ {
6252
+ name: 'dateString',
6253
+ description: 'Date-time string in system time (CST)',
6254
+ type: 'string',
6255
+ },
6256
+ ],
6257
+ returnType: 'string',
6258
+ requiresCoreLoad: true,
6259
+ syntax: 'DateTime.SystemDateToLocalDate(dateString)',
6260
+ example:
6261
+ 'var localTime = DateTime.SystemDateToLocalDate(Platform.Function.Now());\nWrite(localTime);',
6262
+ },
6263
+ {
6264
+ name: 'LocalDateToSystemDate',
6265
+ minArgs: 1,
6266
+ maxArgs: 1,
6267
+ description:
6268
+ 'Converts a date-time value from the local time of the account or user to Marketing Cloud system time (CST).',
6269
+ params: [
6270
+ {
6271
+ name: 'dateString',
6272
+ description: 'Date-time string in local account/user time',
6273
+ type: 'string',
6274
+ },
6275
+ ],
6276
+ returnType: 'string',
6277
+ requiresCoreLoad: true,
6278
+ syntax: 'DateTime.LocalDateToSystemDate(dateString)',
6279
+ example:
6280
+ 'var systemTime = DateTime.LocalDateToSystemDate("8/5/2025 12:34 PM");\nWrite(systemTime);',
6281
+ },
6282
+ ];
6283
+
6239
6284
  // ── DateTime.TimeZone methods ────────────────────────────────────────────────
6240
6285
  // Methods on the DateTime.TimeZone namespace. Require Platform.Load("core", "1.1.5").
6241
6286
 
package/src/urls.js CHANGED
@@ -60,12 +60,14 @@ export const globalFunctionUrl = (name) => `/global-functions/${name.toLowerCase
60
60
  */
61
61
  export const PLATFORM_OBJECT_URLS = {
62
62
  Platform: '/platform-objects/platform-load/',
63
+ 'Platform.Function': '/platform-functions/',
63
64
  'Platform.Variable': '/platform-objects/platform-variable/',
64
65
  'Platform.Response': '/platform-objects/platform-response/',
65
66
  'Platform.Request': '/platform-objects/platform-request/',
66
67
  'Platform.Recipient': '/platform-objects/platform-recipient/',
67
68
  HTTPHeader: '/platform-objects/httpheader/',
68
- 'DateTime.TimeZone': '/platform-objects/datetime-timezone/',
69
+ DateTime: '/platform-objects/datetime/',
70
+ 'DateTime.TimeZone': '/platform-objects/datetime/',
69
71
  ErrorUtil: '/platform-objects/errorutil/',
70
72
  };
71
73
 
@@ -179,4 +181,4 @@ export const GLOBAL_FUNCTION_PAGES = new Set([
179
181
  *
180
182
  * @type {Set.<string>}
181
183
  */
182
- export const PLATFORM_FUNCTION_GLOBAL_ALIAS = new Set([]);
184
+ export const PLATFORM_FUNCTION_GLOBAL_ALIAS = new Set();