Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@matheo/datepicker
Advanced tools
Fork of the official Material Datepicker for Angular with time picking support.
The datepicker allows users to enter a date either through text input, or by choosing a date from the calendar.
As usual, just execute
npm install @matheo/datepicker
# or
yarn add @matheo/datepicker
Then add the modules to your Angular module, or replace the ones imported from @angular/material/datepicker
with these:
import { MatDatepickerModule } from '@matheo/datepicker';
import { MatNativeDateModule } from '@matheo/datepicker/core';
@NgModule({
imports: [
MatNativeDateModule,
MatDatepickerModule,
...
],
...
})
export class AppModule {}
Note that the MatDatepickerModule
can be loaded into feature modules,
but it requires the providers given by MatNativeDateModule
,
so it's recommended to import the former in your root Module.
There's the MatLuxonDateModule
at @matheo/datepicker/luxon
if you use luxon in your application.
<mat-form-field>
<mat-label>Choose a datetime</mat-label>
<input matInput [matDatepicker]="picker" formControlName="datetime" />
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker type="datetime" #picker></mat-datepicker>
</mat-form-field>
This module supports the Angular Material prebuilt themes that can be included in angular.json
:
"styles": [
"node_modules/@angular/material/prebuilt-themes/indigo-pink.css",
"node_modules/@matheo/datepicker/prebuilt-themes/indigo-pink.css",
],
available themes are deeppurple-amber
, indigo-pink
, pink-bluegrey
and purple-green
.
Or you can use your customized Material Theme via mixins:
@use '@angular/material' as mat;
@use '@matheo/datepicker/theming' as datepicker;
mat.$theme-ignore-duplication-warnings: true;
@include mat.core();
...
@include mat.all-component-themes($theme);
@include datepicker.theme($theme)
and add node_modules
to your preprocessor options in yourangular.json
:
"projects": {
"[your-project]": {
"architect": {
"build": {
...
"stylePreprocessorOptions": {
"includePaths": ["node_modules"]
}
}
}
}
For Angular 11 please use @matheo/datepicker@11.2.17.
Some relevant input parameters of the mat-datepicker
:
type
: date | datetime | time | month | year
output type. default: datestartView
: multi-year | year | month | hour | minute
initial view to load. default: monthstartAt
: start Date, otherwise the current selected valueclockStep
: interval to use in the minute view. default: 1twelveHour
: whether to use 12 or 24 hrs format. default: truecolor
: primary | accent | warn
touchUi
: calendar UI mode. default: falsedateClass
: function that can be used to add custom CSS classes to datesand matInput[matDatepicker]
can receive:
matDatepickerFilter
: function of (D, DateUnit?) => boolean
to exclude with a particular algorithm.For a complete API reference please check the official docs: https://material.angular.io/components/datepicker/api
The message strings used in the datepicker's UI can be overriden providing a subclass of MatDatepickerIntl with the translated values in your application root module.
The display and parse formats used by the datepicker can be overriden providing a custom configuration of MatDateFormats via the MAT_DATE_FORMATS
token from @angular/material/core
, and using the NativeDateModule
instead the Mat
-prefixed version which does not include the default formats like:
@NgModule({
imports: [MatDatepickerModule, NativeDateModule],
providers: [
{
provide: MAT_DATE_FORMATS,
useValue: {
parse: {
...
},
display: {
...
}
}
}
],
})
More information in the official docs: https://material.angular.io/components/datepicker/overview#internationalization.
<mat-datepicker type="date" #datePicker></mat-datepicker>
<mat-datepicker type="datetime" #datetimePicker></mat-datepicker>
<mat-datepicker
color="accent"
type="datetime"
startView="year"
#clockPicker
></mat-datepicker>
<mat-datepicker type="time" [twelveHour]="false" #timePicker></mat-datepicker>
<mat-datepicker type="month" #monthPicker></mat-datepicker>
<mat-datepicker type="year" #yearPicker></mat-datepicker>
See the source code of the demo page for more insights.
Further documentation can be found at the official docs: https://material.angular.io/components/datepicker/overview
Enjoy!
FAQs
Angular material date+time picker
We found that @matheo/datepicker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.