Skip to content

Material DatePicker provide Date implementation #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Alex130 opened this issue Jan 30, 2018 · 0 comments
Open

Material DatePicker provide Date implementation #191

Alex130 opened this issue Jan 30, 2018 · 0 comments

Comments

@Alex130
Copy link

Alex130 commented Jan 30, 2018

Issue type

I'm submitting a (check one):
[ ] Bug report
[ X ] Feature request
[ ] Regression (something that used to work, but stopped working in a newer version)
[ ] Support request
[ ] Documentation issue or request

Prerequisites

Before posting, make sure you do the following (check all):
[ X ] Confirm you are using the latest versions of all necessary packages (or if not, explain why not)
[ X ] Search GitHub for a similar issue or PR
[ ] If submitting a Support request, also search [Stack Overflow][stack-overflow] for similar issues

Current behavior

import { MomentDateAdapter, MatMomentDateModule } from '@angular/material-moment-adapter'; export const MOMENT_DATE_FORMATS: MatDateFormats = { parse: { dateInput: 'D/MM/YYYY' }, display: { dateInput: 'DD/MM/YYYY', monthYearLabel: 'MMMM Y', dateA11yLabel: 'LL', monthYearA11yLabel: 'MMMM Y' } }; providers: [ {provide: APP_CONFIG, useValue: AppConfig}, { provide: MAT_DATE_LOCALE, useValue: 'fr-FR' }, { provide: MAT_DATE_FORMATS, useValue: MOMENT_DATE_FORMATS}, { provide: DateAdapter, useClass : MomentDateAdapter },
Are set in app.modules.ts.

These providers are not used in the Material Datepicker component of json-schema-form, instead, the default native javascript's Date implementation is used.

Expected behavior

json-schema-form should pass the apps' providers and set the Date implementation accordingly.

IMPORTANT: How can we reproduce your problem?

provide MomentDateAdapter as a DateAdapter, display any form containing a Datepicker : it is still a Date and does not work with the user's locale (no timezone/UTC format, leading to -1 on Dates), as in : Issue

Environment

OS name & version: Win 7
Browser name & version: Chrome 64
Angular version: 5.2
Angular JSON Schema Form version(s): 0.7.0-alpha.1
Other relevant software or packages:

"@angular/material": "^5.0.0-rc.2", <- rc.2 because of floating labels regression of angular2-json-schema-form
"@angular/material-moment-adapter": "^5.1.0",

Issue

Any other relevant information

Readable and correct Dates, formatting and values.
Material Doc
Thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant