Skip to content

Commit 33566de

Browse files
committed
Merge branch 'PrasadKasireddy-PrasadKasireddy-patch-1' into dev
2 parents a9a02fb + 54648f8 commit 33566de

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

docs/documentation/docs/controls/DateTimePicker.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ The `DateTimePicker` control can be configured with the following properties:
6969
| timeDisplayControlType | TimeDisplayControlType | no | Specifies what type of control to use when rendering time part. |
7070
| showLabels | boolean | no | Specifies if labels in front of date and time parts should be rendered. |
7171
| placeholder | string | no | Placeholder text for the DatePicker. |
72+
| maxDate | Date | no | The maximum allowable date. |
73+
| minDate | Date | no | The minimum allowable date. |
7274

7375
Enum `TimeDisplayControlType`
7476

src/controls/dateTimePicker/DateTimePicker.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import { isEqual } from '@microsoft/sp-lodash-subset';
33
import { TimeConvention, DateConvention } from "./DateTimeConventions";
44
import { DatePicker } from "office-ui-fabric-react/lib/DatePicker";
55
import { Label } from "office-ui-fabric-react/lib/Label";
6-
import { IDropdownOption } from "office-ui-fabric-react/lib/Dropdown";
7-
import * as strings from "ControlStrings";
86
import ErrorMessage from "../errorMessage/ErrorMessage";
97
import styles from "./DateTimePicker.module.scss";
108
import HoursComponent from "./HoursComponent";
@@ -205,7 +203,9 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
205203
strings: dateStrings = new DateTimePickerStrings(), // Defines the DatePicker control labels
206204
timeDisplayControlType,
207205
placeholder,
208-
showLabels
206+
showLabels,
207+
minDate,
208+
maxDate
209209
} = this.props;
210210

211211
const hours: number = value != null ? value.getHours() : this.state.hours;
@@ -293,6 +293,8 @@ export class DateTimePicker extends React.Component<IDateTimePickerProps, IDateT
293293
showMonthPickerAsOverlay={showMonthPickerAsOverlay}
294294
showWeekNumbers={showWeekNumbers}
295295
placeholder={placeholder}
296+
minDate={minDate}
297+
maxDate={maxDate}
296298
/>
297299
</div>
298300
</div>

src/controls/dateTimePicker/IDateTimePickerProps.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,16 @@ export interface IDateTimePickerProps {
107107
* Placeholder text for the DatePicker
108108
*/
109109
placeholder?: string;
110+
111+
/**
112+
* The minimum allowable date for the DatePicker
113+
*/
114+
115+
minDate?: Date;
116+
117+
/**
118+
* The maximum allowable date for the DatePicker
119+
*/
120+
121+
maxDate?: Date;
110122
}

src/webparts/controlsTest/components/ControlsTest.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,14 @@ export default class ControlsTest extends React.Component<IControlsTestProps, IC
605605
<DateTimePicker label="DateTime Picker no seconds" value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
606606
<DateTimePicker label="DateTime Picker (unspecified = date and time)" timeConvention={TimeConvention.Hours24} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
607607
<DateTimePicker label="DateTime Picker dropdown" showSeconds={true} timeDisplayControlType={TimeDisplayControlType.Dropdown} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
608-
<DateTimePicker label="DateTime Picker date only" showLabels={false} dateConvention={DateConvention.Date} value={new Date()} onChange={(value) => console.log("DateTimePicker value:", value)} />
608+
<DateTimePicker
609+
label="DateTime Picker date only"
610+
showLabels={false}
611+
dateConvention={DateConvention.Date}
612+
value={new Date()}
613+
onChange={(value) => console.log("DateTimePicker value:", value)}
614+
minDate={new Date("05/01/2019")}
615+
maxDate={new Date("05/01/2020")} />
609616

610617
{/* <RichText isEditMode={this.props.displayMode === DisplayMode.Edit} onChange={value => { this.richTextValue = value; return value; }} /> */}
611618
<RichText isEditMode={this.props.displayMode === DisplayMode.Edit} onChange={value => { this.setState({ richTextValue: value }); return value; }} />

0 commit comments

Comments
 (0)