
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
@angular/material-moment-adapter
Advanced tools
@angular/material-moment-adapter is an Angular package that provides a Moment.js adapter for Angular Material's datepicker. It allows you to use Moment.js to parse, format, and manipulate dates within Angular Material components.
Date Adapter Configuration
This code demonstrates how to configure the Moment.js date adapter in an Angular module. It imports the necessary modules and sets the adapter options to use UTC.
import { NgModule } from '@angular/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatMomentDateModule, MAT_MOMENT_DATE_ADAPTER_OPTIONS } from '@angular/material-moment-adapter';
@NgModule({
imports: [
MatDatepickerModule,
MatMomentDateModule
],
providers: [
{ provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } }
]
})
export class AppModule { }
Using Moment.js with Angular Material Datepicker
This code shows how to use Moment.js with Angular Material's datepicker component. It initializes a date using Moment.js and binds it to the datepicker input.
import { Component } from '@angular/core';
import * as moment from 'moment';
@Component({
selector: 'app-datepicker',
template: '<mat-form-field><input matInput [matDatepicker]="picker" placeholder="Choose a date"><mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle><mat-datepicker #picker></mat-datepicker></mat-form-field>'
})
export class DatepickerComponent {
selectedDate = moment();
}
@angular/material-luxon-adapter provides a Luxon adapter for Angular Material's datepicker. Luxon is a modern JavaScript date library that offers a more comprehensive and immutable API compared to Moment.js. It is a good alternative if you prefer using Luxon over Moment.js.
@angular/material-date-fns-adapter provides a date-fns adapter for Angular Material's datepicker. date-fns is a lightweight and modular date library that allows you to import only the functions you need. It is a good alternative if you are looking for a smaller bundle size and tree-shakable date library.
The sources for this package are in the main Angular Material repo. Please file issues and pull requests against that repo.
License: MIT
20.1.0 "metal-brownie" (2025-07-09)
There have been some internal mapping changes in Material 2 theme config maps generated by mat.define-light-theme
and mat.define-dark-theme
.
If your app was directly modifying these internal properties to alter styles, such as setting new color values used in the foreground and background palette maps, then your changes may no longer be applied to the components. The supported path for changing theme values is through each component’s overrides API.
The Material 2 component styles have undergone minor adjustments to enhance consistency across components and better align with the latest Material 2 specification. These changes result in a closer adherence to system-level colors such as surface
, background
, disabled
, and surface
variants. In general, these changes are slight hue differences for grey colors that aren’t very noticeable.
| Commit | Type | Description | | -- | -- | -- | | f446d7c412 | feat | drag-drop: add opt-in indicator of pick-up position (#31288) | | 5564d7d016 | feat | menu: add setActiveMenuItem to cdkMenu (#31371) | | 6dc2f3ba50 | fix | a11y: allow mixed types to be passed into setActiveItem (#31462) | | cfa97bb785 | fix | dialog: avoid setting aria-hidden before focus has moved (#31030) |
| Commit | Type | Description | | -- | -- | -- | | 243845460d | feat | chips: add (optional) edit icon to input chips (#31041) | | 9e942b4ba2 | feat | menu: add support for context menu | | 4de7c0fb2d | feat | testing: Extend Angular harness testing functionality (#30960) | | 512433b6d1 | fix | badge: remove badge opacity color mix (#31213) | | 92a8253e28 | fix | badge: use system disabled states (#31266) | | a7150d42cf | fix | button-toggle: simplify divider color (#31214) | | 1f8b1302f2 | fix | button-toggle: use system colors (#31231) | | 5ee7d79e4c | fix | button: FAB emitting invalid elevation tokens (#31028) | | 8523397fd2 | fix | button: prevents mat-icon being cut off by text-spacing (#30891) | | afe36e4d42 | fix | button: remove internal-only M2 styles (#31017) | | 589ea5905e | fix | button: remove internal-only M2 styles (#31018) | | 0d47628d2e | fix | button: use system colors for state layers and text (#31278) | | 203c1737eb | fix | card: subtitle text token should be on-surface-variant (#31261) | | 55b7ba0814 | fix | card: use system outline (#31218) | | eb9abc366f | fix | checkbox: remove internal-only M2 styles (#31019) | | 458a17ba46 | fix | checkbox: update tokens to system colors (#31279) | | 68d7ea0351 | fix | chips: provide ability to edit for all screen readers with a click on already focused chip (#30983) | | 8c9cae0a8c | fix | chips: sync with g3 (#31393) | | be48108bc2 | fix | chips: update tokens to system colors (#31280) | | 20ac2b2bd8 | fix | core: improve disabled psuedo checkbox contrast (#31464) | | 576a008b09 | fix | core: remove unused form field mixins (#31283) | | 4d67427cef | fix | core: update ripple tokens to system colors (#31282) | | 28f2763f96 | fix | core: update tokens to system colors (#31281) | | 009424c73e | fix | datepicker: use system colors (#31300) | | a24081f2bd | fix | dialog: remove internal-only M2 styles (#31020) | | d52ede5627 | fix | expansion: add token for box shadow (#31340) | | ecc6a09ca5 | fix | expansion: align state layer colors (#31236) | | e57aef2912 | fix | expansion: use correct typography (#31347) | | 82ab91e58a | fix | form-field: remove internal-only M2 styles (#31021) | | 6d27e04051 | fix | form-field: use system for neutral colors (#31272) | | 918b625438 | fix | list: update tokens to system colors (#31284) | | a62164db5b | fix | menu: do not auto-focus when hover opens menu (#31257) | | 623030b50d | fix | menu: update tokens to system colors (#31285) | | 0f26b91425 | fix | paginator: update tokens to system colors (#31286) | | 9a96db3233 | fix | select: remove internal-only M2 styles (#31022) | | 010122ff2a | fix | select: use system color for arrow (#31302) | | 89d9cd07bc | fix | slide-toggle: use system colors (#31303) | | c10f376a5f | fix | slide-toggle: use token system for label text (#31366) | | 029e39cced | fix | slider: use system color (#31305) | | 7bb0a82a43 | fix | snack-bar: use inverse primary for button color (#31465) | | d22191a619 | fix | sort: simplify m2 sort color (#31165) | | 680dd6fa80 | fix | stepper: align state colors (#31227) | | 0a47244b6c | fix | stepper: use system color for error text (#31333) | | ea76df6040 | fix | tabs: fix missing token values (#31345) | | 951f37e656 | fix | tabs: update tokens to system colors (#31287) | | f26ff4ece4 | fix | toolbar: use correct typography (#31348) | | 4b85f9f62b | fix | toolbar: use system surface for neutral background (#31234) | | ae3b0bfcf3 | fix | tree: use correct typography (#31349) |
| Commit | Type | Description | | -- | -- | -- | | 4f9ab216c1 | feat | accordion: add accordion directives, example, and tests (#31134) | | 3704b7e32f | feat | radio: add radio demo to dev-app (#31180) | | 50c3e0e12d | feat | radio: create radio group and button directives (#31050) | | cdc0dab261 | feat | tabs: add setDefaultState and unit tests, refactor the content children strategy (#31374) | | 97d60c5378 | feat | tree: add tree directives, example, and tests (#31350) | | ff0f6c61b5 | feat | ui-patterns: accordion (#31034) | | c5b2f0ac6d | feat | ui-patterns: create grid navigation behavior (#31290) | | ce145fa9a3 | feat | ui-patterns: create the grid focus behavior (#31055) | | 9f249d0a25 | feat | ui-patterns: radio button and group (#31016) | | 70841dbb5b | feat | ui-patterns: tree (#31308) | | 06d7384a23 | fix | accordion: fix disabled trigger button can't be focused when skipDisabled=false (#31379) | | 9a856ad559 | fix | tabs: fix tabs example styles (#31382) | | 8a091a7ea8 | fix | tabs: set tabpanel tabindex to -1 if hidden (#31401) | | ea700e6d81 | fix | ui-patterns: add guardrails to selectOne for edge cases (#31402) |
| Commit | Type | Description | | -- | -- | -- | | dc3ae8d945 | fix | update goldens (#31123) | | e462301f8f | fix | use inline m2 token definitions (#31359) | | 5546d10992 | fix | use system on-surface (#31225) |
<!-- CHANGELOG SPLIT MARKER --><a name="20.0.6"></a>
FAQs
Angular Material Moment Adapter
The npm package @angular/material-moment-adapter receives a total of 287,197 weekly downloads. As such, @angular/material-moment-adapter popularity was classified as popular.
We found that @angular/material-moment-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.