From f954ab6f10cf9ad86e79ad72360b9ec9f95a0a85 Mon Sep 17 00:00:00 2001 From: Nick Hodges Date: Fri, 26 Jun 2020 06:08:18 -0400 Subject: [PATCH] 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 --- aio/content/examples/pipes/src/app/app.component.ts | 2 +- aio/content/examples/pipes/src/app/hero-birthday1.component.ts | 2 +- aio/content/examples/pipes/src/app/hero-birthday2.component.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aio/content/examples/pipes/src/app/app.component.ts b/aio/content/examples/pipes/src/app/app.component.ts index 2b739ed2a0..5b71cc53c7 100644 --- a/aio/content/examples/pipes/src/app/app.component.ts +++ b/aio/content/examples/pipes/src/app/app.component.ts @@ -6,5 +6,5 @@ import { Component } from '@angular/core'; templateUrl: './app.component.html' }) 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 } diff --git a/aio/content/examples/pipes/src/app/hero-birthday1.component.ts b/aio/content/examples/pipes/src/app/hero-birthday1.component.ts index d51914550f..4b475e80d6 100644 --- a/aio/content/examples/pipes/src/app/hero-birthday1.component.ts +++ b/aio/content/examples/pipes/src/app/hero-birthday1.component.ts @@ -8,5 +8,5 @@ import { Component } from '@angular/core'; // #enddocregion hero-birthday-template }) 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 } diff --git a/aio/content/examples/pipes/src/app/hero-birthday2.component.ts b/aio/content/examples/pipes/src/app/hero-birthday2.component.ts index ce71c2ab1e..f8ee3ca911 100644 --- a/aio/content/examples/pipes/src/app/hero-birthday2.component.ts +++ b/aio/content/examples/pipes/src/app/hero-birthday2.component.ts @@ -12,7 +12,7 @@ import { Component } from '@angular/core'; }) // #docregion class 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 get format() { return this.toggle ? 'shortDate' : 'fullDate'; }