UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

23 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CustomDateTimeWidget = void 0; var tslib_1 = require("tslib"); var moment_1 = (0, tslib_1.__importDefault)(require("moment")); var react_1 = (0, tslib_1.__importDefault)(require("react")); var CalendarWithIconFormGroup_1 = require("../../evaluation_queues/CalendarWithIconFormGroup"); /** * DateTime picker widget compatible with react-jsonschema-form and Synapse Datetime annotations. */ var CustomDateTimeWidget = function (_a) { var disabled = _a.disabled, value = _a.value, onChange = _a.onChange; return (react_1.default.createElement(CalendarWithIconFormGroup_1.CalendarWithIconFormGroup, { disabled: disabled, value: value ? (0, moment_1.default)(value) : '', setterCallback: function (newValue) { if (newValue == null || typeof newValue === 'string') { onChange(newValue); } else { onChange(newValue.toISOString()); } } })); }; exports.CustomDateTimeWidget = CustomDateTimeWidget; //# sourceMappingURL=CustomDateTimeWidget.js.map