Skip to content

Commit

Permalink
Fix compatibility with 5.0 RC
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 23, 2018
1 parent c73669a commit c003845
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
10 changes: 1 addition & 9 deletions scripts/fields/fields/date.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { DatePicker } from "@wordpress/components";
import { getSettings } from "@wordpress/date";
import { __ } from "@wordpress/i18n";
import { createElement } from "@wordpress/element";

Expand All @@ -9,16 +8,9 @@ const dateField = {
name: "date",
label: __("Date", "gutenberg-custom-fields"),
editForm: fieldConfig => ({ value, onChange }) => {
const settings = getSettings();
return (
<Field label={fieldConfig.title || fieldConfig.name}>
{() => (
<DatePicker
locale={settings.l10n.locale}
currentDate={value}
onChange={onChange}
/>
)}
{() => <DatePicker currentDate={value} onChange={onChange} />}
</Field>
);
}
Expand Down
5 changes: 2 additions & 3 deletions scripts/fields/fields/datetime.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { DateTimePicker } from "@wordpress/components";
import { getSettings } from "@wordpress/date";
import { __experimentalGetSettings } from "@wordpress/date";
import { __ } from "@wordpress/i18n";
import { createElement } from "@wordpress/element";

import Field from "../components/field";

// To know if the current timezone is a 12 hour time with look for "a" in the time format
// We also make sure this a is not escaped by a "/"
const settings = getSettings();
const settings = __experimentalGetSettings();
const is12HourTime = /a(?!\\)/i.test(
settings.formats.time
.toLowerCase() // Test only the lower case a
Expand All @@ -25,7 +25,6 @@ const datetimeField = {
<Field label={fieldConfig.title || fieldConfig.name}>
{() => (
<DateTimePicker
locale={settings.l10n.locale}
currentDate={value}
is12HourTime={is12HourTime}
onChange={onChange}
Expand Down
5 changes: 2 additions & 3 deletions scripts/fields/fields/time.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TimePicker } from "@wordpress/components";
import { getSettings } from "@wordpress/date";
import { __experimentalGetSettings } from "@wordpress/date";
import { __ } from "@wordpress/i18n";
import { createElement } from "@wordpress/element";

import Field from "../components/field";

// To know if the current timezone is a 12 hour time with look for "a" in the time format
// We also make sure this a is not escaped by a "/"
const settings = getSettings();
const settings = __experimentalGetSettings();
const is12HourTime = /a(?!\\)/i.test(
settings.formats.time
.toLowerCase() // Test only the lower case a
Expand All @@ -25,7 +25,6 @@ const timeField = {
<Field label={fieldConfig.title || fieldConfig.name}>
{() => (
<TimePicker
locale={settings.l10n.locale}
currentTime={value}
is12HourTime={is12HourTime}
onChange={onChange}
Expand Down

0 comments on commit c003845

Please sign in to comment.