Skip to content

Commit

Permalink
fix(datepicker): export MD_DATE_FORMATS and MD_NATIVE_DATE_FORMATS
Browse files Browse the repository at this point in the history
* Makes the MD_DATE_FORMATS and MD_NATIVE_DATE_FORMATS public.
* Fixes some trailing whitespace in the datepicker readme.

Fixes angular#4534.
  • Loading branch information
crisbeto committed May 14, 2017
1 parent 6121fa1 commit 5bfaf49
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/lib/core/datetime/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {MD_NATIVE_DATE_FORMATS} from './native-date-formats';


export * from './date-adapter';
export * from './date-formats';
export * from './native-date-adapter';
export * from './native-date-formats';


@NgModule({
Expand Down
10 changes: 5 additions & 5 deletions src/lib/datepicker/datepicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The month or year that the calendar opens to is determined by first checking if
currently selected, if so it will open to the month or year containing that date. Otherwise it will
open to the month or year containing today's date. This behavior can be overridden by using the
`startAt` property of `md-datepicker`. In this case the calendar will open to the month or year
containing the `startAt` date.
containing the `startAt` date.

```ts
startDate = new Date(1990, 0, 1);
Expand All @@ -66,7 +66,7 @@ There are three properties that add date validation to the datepicker input. The
disable all dates on the calendar popup before or after the respective values and prevent the user
from advancing the calendar past the `month` or `year` (depending on current view) containing the
`min` or `max` date.

The second way to add date validation is using the `mdDatepickerFilter` property of the datepicker
input. This property accepts a function of `<D> => boolean` (where `<D>` is the date type used by
the datepicker, see section on
Expand All @@ -78,7 +78,7 @@ dates before or after a certain point, will not prevent the user from advancing
that point.

```ts
myFilter = (d: Date) => d.getFullYear() > 2005
myFilter = (d: Date) => d.getFullYear() > 2005
minDate = new Date(2000, 0, 1);
maxDate = new Date(2020, 11, 31);
```
Expand Down Expand Up @@ -111,7 +111,7 @@ The calendar popup can be programmatically controlled using the `open` and `clos
@Component({...})
export class MyComponent implements AfterViewInit {
@ViewChild(MdDatepicker) dp: MdDatepicker<Date>;

ngAfterViewInit() {
dp.open();
}
Expand All @@ -126,7 +126,7 @@ The easiest way to ensure this is just to import one of the pre-made modules (cu
`MdNativeDateModule` is the only implementation that ships with material, but there are plans to add
a module for Moment.js support):
* `MdNativeDateModule` - support for native JavaScript Date object

These modules include providers for `DateAdapter` and `MD_DATE_FORMATS`

```ts
Expand Down

0 comments on commit 5bfaf49

Please sign in to comment.