ssjs-data 0.3.5 → 0.4.1

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.
@@ -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.1",
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();