@rkmodules/rules 0.0.126 → 0.0.128

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/dist/index.cjs.js CHANGED
@@ -2517,7 +2517,7 @@ var formatDate = {
2517
2517
  impl: function (inputs, params, engine) { return __awaiter(void 0, void 0, void 0, function () {
2518
2518
  return __generator(this, function (_a) {
2519
2519
  return [2 /*return*/, {
2520
- string: mapTree(inputs.date, function (dateInput) {
2520
+ string: mapTree(inputs.date || {}, function (dateInput) {
2521
2521
  var parsedDate = new Date(dateInput || Date.now());
2522
2522
  if (isNaN(parsedDate.getTime())) {
2523
2523
  return [];
@@ -2578,7 +2578,7 @@ var formatDate = {
2578
2578
  if (isNaN(parsedDate.getTime())) {
2579
2579
  return "invalid date";
2580
2580
  }
2581
- return new Date()
2581
+ return parsedDate
2582
2582
  .toLocaleString("sv", {
2583
2583
  timeZone: params.timezone,
2584
2584
  timeZoneName: "longOffset",
@@ -2653,7 +2653,40 @@ var isoDate = {
2653
2653
  }); },
2654
2654
  };
2655
2655
 
2656
+ var today = {
2657
+ name: "today",
2658
+ label: "Today",
2659
+ description: "The date of today",
2660
+ inputs: {},
2661
+ outputs: {
2662
+ iso: "string",
2663
+ date: "string",
2664
+ time: "string",
2665
+ },
2666
+ impl: function (inputs, params, engine) { return __awaiter(void 0, void 0, void 0, function () {
2667
+ return __generator(this, function (_a) {
2668
+ return [2 /*return*/, {
2669
+ date: broadCast(new Date().toLocaleDateString("sv", {
2670
+ timeZone: params.timezone,
2671
+ dateStyle: "short",
2672
+ })),
2673
+ time: broadCast(new Date().toLocaleTimeString("sv", {
2674
+ timeZone: params.timezone,
2675
+ })),
2676
+ iso: broadCast(new Date()
2677
+ .toLocaleString("sv", {
2678
+ timeZone: params.timezone,
2679
+ timeZoneName: "longOffset",
2680
+ })
2681
+ .replace(" ", "T")
2682
+ .replace(" GMT", "")),
2683
+ }];
2684
+ });
2685
+ }); },
2686
+ };
2687
+
2656
2688
  var functions = {
2689
+ today: today,
2657
2690
  parseDate: parseDate,
2658
2691
  formatDate: formatDate,
2659
2692
  isoDate: isoDate,