{"id":49963267,"url":"https://github.com/eastcoastdeveloper/datepicker-angular-component","last_synced_at":"2026-05-18T03:25:00.438Z","repository":{"id":165851677,"uuid":"561201446","full_name":"eastcoastdeveloper/datepicker-angular-component","owner":"eastcoastdeveloper","description":"Angular Date Picker Component","archived":false,"fork":false,"pushed_at":"2025-12-05T22:15:47.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-09T12:11:31.813Z","etag":null,"topics":["angular","angular-app","angular-component","angular-components","angular-date-input","angular-datepicker","angular2","component","date-picker","datepicker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eastcoastdeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-11-03T07:08:26.000Z","updated_at":"2025-12-05T22:15:51.000Z","dependencies_parsed_at":"2025-12-06T10:05:33.205Z","dependency_job_id":null,"html_url":"https://github.com/eastcoastdeveloper/datepicker-angular-component","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eastcoastdeveloper/datepicker-angular-component","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eastcoastdeveloper%2Fdatepicker-angular-component","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eastcoastdeveloper%2Fdatepicker-angular-component/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eastcoastdeveloper%2Fdatepicker-angular-component/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eastcoastdeveloper%2Fdatepicker-angular-component/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eastcoastdeveloper","download_url":"https://codeload.github.com/eastcoastdeveloper/datepicker-angular-component/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eastcoastdeveloper%2Fdatepicker-angular-component/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular-app","angular-component","angular-components","angular-date-input","angular-datepicker","angular2","component","date-picker","datepicker"],"created_at":"2026-05-18T03:24:59.706Z","updated_at":"2026-05-18T03:25:00.433Z","avatar_url":"https://github.com/eastcoastdeveloper.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Angular Custom Date Picker Component ##\n\nA fully custom, Angular date-picker component built with HTML, SCSS, and TypeScript.\nThis component provides:\n\nA dropdown calendar\n\nMonth \u0026 year selectors\n\nHighlighting of the current day\n\nPrevention of selecting future dates\n\nA 6×7 (42-cell) grid that dynamically renders all days of the selected month\n\nA clean UI wrapper matching standard Angular component patterns\n\n### Directory Structure ###\n/src/app/date-picker/\n\n│── date-picker.component.html\n\n│── date-picker.component.scss\n\n│── date-picker.component.ts\n\nInclude the date picker inside any page using:\n\n```\n\u003cdiv class=\"date-picker\"\u003e\n  \u003cdiv app-calendar\u003e\u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Features ###\n\n#### Custom Calendar Renderer ####\n\nBuilds a 42-cell date grid (6 weeks) including leading/trailing blank cells for alignment.\n\n#### Month \u0026 Year Dropdowns ####\n\nClick the month or year to toggle dropdown menus.\n\n#### Current Date Highlight ####\n\nAutomatically highlights today’s date.\n\n#### Future Date Restriction ####\n\nSelecting a future date triggers an alert.\n\n#### Simple, Reusable Markup ####\n\nCan be dropped into any Angular component with minimal setup.\n\n### Usage ###\n\n```\n\u003cdiv id=\"calendar-component\"\u003e\n  \u003cinput\n    type=\"text\"\n    placeholder=\"Select a date...\"\n    (focus)=\"openCalendar()\"\n    [ngClass]=\"{ 'future-date': selectedDate \u003e currentDate }\"\n    value=\"{{ months[monthIndex] + ' ' + currentDay + ', ' + year }}\"\n  /\u003e\n\n  \u003cdiv *ngIf=\"calendarVisible\" class=\"calendar\"\u003e\n    \u003c!-- Navigation --\u003e\n    \u003cnav\u003e\n      \u003cdiv class=\"close-calendar\" (click)=\"closeCalendar()\"\u003e\n        \u003cspan\u003e\u0026#x2715;\u003c/span\u003e\n      \u003c/div\u003e\n\n      \u003c!-- Month selector --\u003e\n      \u003cdiv class=\"month\" (click)=\"showMonths()\"\u003e\n        \u003cspan\u003e{{ months[monthIndex] }}\u003c/span\u003e\n        \u003cdiv class=\"caret\" [ngClass]=\"{ rotate: monthsMenu }\"\u003e\u003c/div\u003e\n        \u003cul *ngIf=\"monthsMenu\"\u003e\n          \u003cli *ngFor=\"let month of months; let i = index\" (click)=\"selectMonth(i)\"\u003e\n            {{ month }}\n          \u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/div\u003e\n\n      \u003c!-- Year selector --\u003e\n      \u003cdiv class=\"year\" (click)=\"showYears()\"\u003e\n        \u003cspan\u003e{{ year }}\u003c/span\u003e\n        \u003cdiv class=\"caret\" [ngClass]=\"{ rotate: yearsMenu }\"\u003e\u003c/div\u003e\n        \u003cul *ngIf=\"yearsMenu\"\u003e\n          \u003cli *ngFor=\"let year of years\" (click)=\"selectYear(year)\"\u003e\n            {{ year }}\n          \u003c/li\u003e\n        \u003c/ul\u003e\n      \u003c/div\u003e\n    \u003c/nav\u003e\n\n    \u003c!-- Weekdays --\u003e\n    \u003cdiv class=\"weekdays\"\u003e\n      \u003cul\u003e\n        \u003cli *ngFor=\"let day of weekdays\"\u003e{{ day }}\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/div\u003e\n\n    \u003c!-- Day Grid --\u003e\n    \u003cdiv class=\"all-days-skeleton\"\u003e\n      \u003cdiv\n        *ngFor=\"let day of daySpan\"\n        (click)=\"selectDay(day)\"\n        [ngClass]=\"{\n          'has-value': day.value != null,\n          'current-date': day.value === currentDay\n        }\"\n      \u003e\n        \u003cdiv class=\"day-value\"\u003e{{ day.value }}\u003c/div\u003e\n      \u003c/div\u003e\n    \u003c/div\u003e\n  \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Component Logic (date-picker.component.ts) ###\n\nThe component handles:\n\nCalculating first/last day of each month\n\nGenerating a 42-cell matrix\n\nToggling calendar visibility\n\nSelecting month/year/day\n\nBlocking future dates\n\n```\nimport { Component, OnInit } from '@angular/core';\n\n@Component({\n  selector: '[app-calendar]',\n  templateUrl: './date-picker.component.html',\n  styleUrls: ['./date-picker.component.scss'],\n})\nexport class DatepickerComponent implements OnInit {\n  calendarVisible = false;\n  d = new Date();\n\n  weekdays = ['S', 'M', 'T', 'W', 'T', 'F', 'S'];\n  months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];\n\n  // Set Years\n  years = [\n    2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,\n    2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025\n  ];\n\n  currentDay = this.d.getDate();\n  monthIndex = this.d.getMonth();\n  year = this.d.getFullYear();\n\n  firstDay: any;\n  lastDay: any;\n\n  monthsMenu = false;\n  yearsMenu = false;\n\n  daySpan: any[] = [];\n\n  selectedDate: number;\n  currentDate: number;\n\n  ngOnInit() {\n    this.firstLastDays();\n  }\n\n  calculateStartEndDate(firstDayOfMonth: number, lastDayOfMonth: number) {\n    this.daySpan = [];\n    let dayIndex = 1, emptyCells = 0;\n\n    for (let i = 0; i \u003c 42; i++) {\n      if (firstDayOfMonth \u003e i) emptyCells++;\n      this.daySpan.push({\n        value:\n          i \u003e= firstDayOfMonth \u0026\u0026 i \u003c emptyCells + lastDayOfMonth\n            ? dayIndex++\n            : null,\n      });\n    }\n  }\n\n  firstLastDays() {\n    this.firstDay = new Date(this.year, this.monthIndex, 1);\n    this.lastDay = new Date(this.year, this.monthIndex + 1, 0);\n    this.calculateStartEndDate(this.firstDay.getDay(), this.lastDay.getDate());\n  }\n\n  selectYear(year: number) {\n    this.year = year;\n    this.firstLastDays();\n    this.checkForFutureDate(year, this.monthIndex, this.currentDay);\n  }\n\n  selectMonth(i: number) {\n    this.monthIndex = i;\n    this.firstLastDays();\n    this.checkForFutureDate(this.year, this.monthIndex + 1, this.currentDay);\n  }\n\n  selectDay(dayObj: any) {\n    this.currentDay = dayObj.value;\n    this.checkForFutureDate(this.year, this.monthIndex, this.currentDay);\n  }\n\n  openCalendar() {\n    this.calendarVisible = true;\n  }\n\n  closeCalendar() {\n    this.calendarVisible = false;\n  }\n\n  showMonths() {\n    this.monthsMenu = !this.monthsMenu;\n    this.yearsMenu = false;\n  }\n\n  showYears() {\n    this.yearsMenu = !this.yearsMenu;\n    this.monthsMenu = false;\n  }\n\n  checkForFutureDate(y: number, m: number, d: number) {\n    this.selectedDate = new Date(y, m, d).getTime();\n    this.currentDate = new Date().getTime();\n\n    if (this.selectedDate \u003e this.currentDate) {\n      alert('Please select a non future date');\n    }\n  }\n}\n```\n\n### License ###\n\nMIT — free to use, modify, and integrate into any Angular project.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feastcoastdeveloper%2Fdatepicker-angular-component","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feastcoastdeveloper%2Fdatepicker-angular-component","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feastcoastdeveloper%2Fdatepicker-angular-component/lists"}