Installations
npm install @mat-datetimepicker/core
Developer
kuhnroyal
Developer Guide
Module System
ESM
Min. Node Version
Typescript Support
No
Node Version
20.14.0
NPM Version
10.8.1
Statistics
153 Stars
515 Commits
84 Forks
7 Watching
4 Branches
23 Contributors
Updated on 09 Nov 2024
Languages
TypeScript (77.16%)
HTML (12.27%)
SCSS (8.2%)
JavaScript (2.37%)
Total Downloads
Cumulative downloads
Total Downloads
2,768,345
Last day
15.6%
3,222
Compared to previous day
Last week
2.4%
15,074
Compared to previous week
Last month
0.3%
67,925
Compared to previous month
Last year
24%
675,854
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
Peer Dependencies
4
Material Datetimepicker for @angular/material
The example application is on GitHub Pages!
The datetimepicker was initially taken from Promact/md2
and modified to
use @angular/material
. We have also added theming support.
Like the @angular/material
datepicker
it contains a native-datetime-adapter
as well as a moment-datetime-adapter
.
Contents
Usage
Installation
Install:
1npm install --save @mat-datetimepicker/core
And for the moment adapter:
1npm install --save @angular/material-moment-adapter mat-datetimepicker/moment
Setup
Basically the same way the @angular/material
datepicker is configured and imported.
1imports: [ 2 ...MatDatepickerModule, 3 // use this if you want to use native javascript dates and INTL API if available 4 // MatNativeDatetimeModule, 5 MatMomentDatetimeModule, 6 MatDatetimepickerModule, 7];
Using the component
1<form [formGroup]="group"> 2 <mat-form-field> 3 <mat-placeholder>Start DateTime</mat-placeholder> 4 <mat-datetimepicker-toggle [for]="datetimePicker" matSuffix></mat-datetimepicker-toggle> 5 <mat-datetimepicker #datetimePicker type="datetime" openOnFocus="true" timeInterval="5"> </mat-datetimepicker> 6 <input matInput formControlName="start" [matDatetimepicker]="datetimePicker" required autocomplete="false" /> 7 </mat-form-field> 8</form>
Date formatting
In order to change the default input/output formats, a custom instance of MAT_DATETIME_FORMATS
needs to be provided in
the global configuration.
Input/output formats can be changed separately for the existing datetime picker types
date
, month
, datetime
and time
.
Accessibility
You can use the following properties to provide values for ARIA- attributes:
Property | Description | Default |
---|---|---|
ariaNextMonthLabel | aria-label for the Next button in the month mode | "Next month" |
ariaPrevMonthLabel | aria-label for the Previous button in the month mode | "Previous month" |
ariaNextYearLabel | aria-label for the Next button in the year mode | "Next year" |
ariaPrevYearLabel | aria-label for the Previous button in the year mode | "Previous year" |
The component supports property bindings or pipes with the aria- values.
Native
Parsing does not work with the native adapter because the Intl.DateTimeFormat API does not provide that feature.
1providers: [ 2 { 3 provide: MAT_DATETIME_FORMATS, 4 useValue: { 5 parse: {}, 6 display: { 7 dateInput: { 8 year: 'numeric', 9 month: '2-digit', 10 day: '2-digit', 11 }, 12 monthInput: { 13 month: 'long', 14 }, 15 datetimeInput: { 16 year: 'numeric', 17 month: '2-digit', 18 day: '2-digit', 19 hour: '2-digit', 20 minute: '2-digit', 21 }, 22 timeInput: { 23 hour: '2-digit', 24 minute: '2-digit', 25 }, 26 monthYearLabel: { 27 year: 'numeric', 28 month: 'short', 29 }, 30 dateA11yLabel: { 31 year: 'numeric', 32 month: 'long', 33 day: 'numeric', 34 }, 35 monthYearA11yLabel: { 36 year: 'numeric', 37 month: 'long', 38 }, 39 popupHeaderDateLabel: { 40 weekday: 'short', 41 month: 'short', 42 day: '2-digit', 43 }, 44 }, 45 }, 46 }, 47];
@see defaults in native-datetime-formats.ts
@see Intl.DateTimeFormat
API documentation
Moment
1providers: [ 2 { 3 provide: MAT_DATETIME_FORMATS, 4 useValue: { 5 parse: { 6 dateInput: 'L', 7 monthInput: 'MMMM', 8 timeInput: 'LT', 9 datetimeInput: 'L LT', 10 }, 11 display: { 12 dateInput: 'L', 13 monthInput: 'MMMM', 14 datetimeInput: 'L LT', 15 timeInput: 'LT', 16 monthYearLabel: 'MMM YYYY', 17 dateA11yLabel: 'LL', 18 monthYearA11yLabel: 'MMMM YYYY', 19 popupHeaderDateLabel: 'ddd, DD MMM', 20 }, 21 }, 22 }, 23];
@see defaults in moment-datetime-formats.ts
@see moment.js documentation
Theming
1@import '@mat-datetimepicker/core/datetimepicker/datetimepicker-theme.scss'; 2 3// Using the $theme variable from the pre-built theme you can call the theming function 4@include mat-datetimepicker-theme($theme);
@see src/styles.scss
Development
Run npm install
in order to install all required dependencies and initialize the Git hooks. Further instructions are
available in the DEVELOPMENT.md
.
Make sure you read at least the "Committing" section before committing anything.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
packaging workflow detected
Details
- Info: Project packages its releases by way of GitHub Actions.: .github/workflows/publish.yaml:6
Reason
3 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-7q7g-4xm8-89cq
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-8mmm-9v2q-x3f9
Reason
8 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 6
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yaml:9: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/lint.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yaml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/lint.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yaml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/lint.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yaml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/lint.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/publish.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/publish.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/release.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/release.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/test.yaml/release?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/kuhnroyal/mat-datetimepicker/test.yaml/release?enable=pin
- Info: 0 out of 10 GitHub-owned GitHubAction dependencies pinned
- Info: 5 out of 5 npmCommand dependencies pinned
Reason
Found 0/7 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/lint.yaml:1
- Warn: no topLevel permission defined: .github/workflows/publish.yaml:1
- Warn: no topLevel permission defined: .github/workflows/release.yaml:1
- Warn: no topLevel permission defined: .github/workflows/test.yaml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
Project has not signed or included provenance with any releases.
Details
- Warn: release artifact v14.0.0 not signed: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/162375054
- Warn: release artifact v13.0.2 not signed: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/146942585
- Warn: release artifact v13.0.1 not signed: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/132737659
- Warn: release artifact v13.0.0 not signed: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/132236541
- Warn: release artifact v12.0.1 not signed: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/123249857
- Warn: release artifact v14.0.0 does not have provenance: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/162375054
- Warn: release artifact v13.0.2 does not have provenance: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/146942585
- Warn: release artifact v13.0.1 does not have provenance: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/132737659
- Warn: release artifact v13.0.0 does not have provenance: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/132236541
- Warn: release artifact v12.0.1 does not have provenance: https://api.github.com/repos/kuhnroyal/mat-datetimepicker/releases/123249857
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 29 are checked with a SAST tool
Score
4.3
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More