@plasmicpkgs/plasmic-rich-components 1.0.113 → 1.0.114

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.
@@ -4,6 +4,7 @@ import React, { useState, useEffect, useRef } from 'react';
4
4
  import { Result, Checkbox, Switch, Empty, Descriptions, theme, ConfigProvider, Dropdown, Button, Input, List, Tag, Card } from 'antd';
5
5
  import 'lodash/get';
6
6
  import { normalizeData, deriveFieldConfigs } from '@plasmicapp/data-sources';
7
+ import { DateTime } from 'luxon';
7
8
  import { tinycolor } from '@ctrl/tinycolor';
8
9
  import { LogoutOutlined, PlusOutlined, EllipsisOutlined } from '@ant-design/icons';
9
10
  import { ProLayout, ProConfigProvider, ProTable } from '@ant-design/pro-components';
@@ -647,6 +648,12 @@ function renderBoolean(value, cconfig) {
647
648
  return value ? "true" : "false";
648
649
  }
649
650
  }
651
+ const dateTimeParsers = [
652
+ DateTime.fromISO,
653
+ DateTime.fromRFC2822,
654
+ DateTime.fromHTTP,
655
+ DateTime.fromSQL
656
+ ];
650
657
  const CANNOT_COERCE = Symbol("plasmic-cannot-coerce");
651
658
  function coerceValue(value, dataType) {
652
659
  if (value == null) {
@@ -668,9 +675,11 @@ function coerceValue(value, dataType) {
668
675
  } else if (typeof value === "number") {
669
676
  return new Date(value);
670
677
  } else if (typeof value === "string") {
671
- const maybeDate = new Date(value);
672
- if (!isNaN(maybeDate.getTime())) {
673
- return maybeDate;
678
+ for (const parser of dateTimeParsers) {
679
+ const parsed = parser(value);
680
+ if (parsed.isValid) {
681
+ return parsed.toJSDate();
682
+ }
674
683
  }
675
684
  }
676
685
  } else if (dataType === "boolean") {
@@ -846,7 +855,7 @@ function registerRichDetails(loader) {
846
855
  bordered: {
847
856
  displayName: "Show borders?",
848
857
  type: "boolean",
849
- defaultValueHint: false
858
+ defaultValue: true
850
859
  }
851
860
  },
852
861
  importPath: "@plasmicpkgs/plasmic-rich-components",