docs: add note about the month being zero-based in the Date constructor (#37770)
Because the month is zero based, it may confuse some users that '3' is in fact 'April'. This comment should clear that up. PR Close #37770
This commit is contained in:
parent
3ee666580a
commit
f954ab6f10
|
@ -6,5 +6,5 @@ import { Component } from '@angular/core';
|
||||||
templateUrl: './app.component.html'
|
templateUrl: './app.component.html'
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
birthday = new Date(1988, 3, 15); // April 15, 1988
|
birthday = new Date(1988, 3, 15); // April 15, 1988 -- since month parameter is zero-based
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,5 @@ import { Component } from '@angular/core';
|
||||||
// #enddocregion hero-birthday-template
|
// #enddocregion hero-birthday-template
|
||||||
})
|
})
|
||||||
export class HeroBirthdayComponent {
|
export class HeroBirthdayComponent {
|
||||||
birthday = new Date(1988, 3, 15); // April 15, 1988
|
birthday = new Date(1988, 3, 15); // April 15, 1988 -- since month parameter is zero-based
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { Component } from '@angular/core';
|
||||||
})
|
})
|
||||||
// #docregion class
|
// #docregion class
|
||||||
export class HeroBirthday2Component {
|
export class HeroBirthday2Component {
|
||||||
birthday = new Date(1988, 3, 15); // April 15, 1988
|
birthday = new Date(1988, 3, 15); // April 15, 1988 -- since month parameter is zero-based
|
||||||
toggle = true; // start with true == shortDate
|
toggle = true; // start with true == shortDate
|
||||||
|
|
||||||
get format() { return this.toggle ? 'shortDate' : 'fullDate'; }
|
get format() { return this.toggle ? 'shortDate' : 'fullDate'; }
|
||||||
|
|
Loading…
Reference in New Issue