office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
51 lines • 2.27 kB
JavaScript
import * as tslib_1 from "tslib";
import * as React from 'react';
import { DatePicker, DayOfWeek } from 'office-ui-fabric-react/lib/DatePicker';
import './DatePicker.Examples.scss';
var DayPickerStrings = {
months: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
],
shortMonths: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
shortDays: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
goToToday: 'Go to today',
prevMonthAriaLabel: 'Go to previous month',
nextMonthAriaLabel: 'Go to next month',
prevYearAriaLabel: 'Go to previous year',
nextYearAriaLabel: 'Go to next year',
closeButtonAriaLabel: 'Close date picker',
isRequiredErrorMessage: 'Field is required.',
invalidInputErrorMessage: 'Invalid date format.'
};
var DatePickerRequiredExample = /** @class */ (function (_super) {
tslib_1.__extends(DatePickerRequiredExample, _super);
function DatePickerRequiredExample(props) {
var _this = _super.call(this, props) || this;
_this.state = {
firstDayOfWeek: DayOfWeek.Sunday
};
return _this;
}
DatePickerRequiredExample.prototype.render = function () {
var firstDayOfWeek = this.state.firstDayOfWeek;
return (React.createElement("div", { className: "docs-DatePickerExample" },
React.createElement("p", null, "Validation will happen when Date Picker loses focus."),
React.createElement(DatePicker, { label: "Date required (with label)", isRequired: true, firstDayOfWeek: firstDayOfWeek, strings: DayPickerStrings, placeholder: "Select a date..." }),
React.createElement(DatePicker, { isRequired: true, firstDayOfWeek: firstDayOfWeek, strings: DayPickerStrings, placeholder: "Date required with no label..." })));
};
return DatePickerRequiredExample;
}(React.Component));
export { DatePickerRequiredExample };
//# sourceMappingURL=DatePicker.Required.Example.js.map