Skip to content
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

add min and max for dateinputs #206

Closed
JBusch opened this issue Dec 13, 2016 · 10 comments
Closed

add min and max for dateinputs #206

JBusch opened this issue Dec 13, 2016 · 10 comments

Comments

@JBusch
Copy link

JBusch commented Dec 13, 2016

Wouldn't it be nice, if we could set min and max for date inputs? we could easily set them which would make a lot of validation obsolete imho.

@udos86
Copy link
Owner

udos86 commented Dec 13, 2016

@JBusch I would not like to add these properties to DynamicInputModel as this is not part of the HTML 5 standard. However I'm planning to introduce a DynamicDatePickerModel as soon as Material 2 does deliver a corresponding UI control. There, your proposal could make a nice addition.

Thanks for your ideas!

@JBusch
Copy link
Author

JBusch commented Dec 13, 2016

well, do i read it false then? https://www.w3.org/TR/html51/sec-forms.html#date-state-typedate

The following common input element content attributes, IDL attributes, and methods apply to the element: autocomplete, list, max, min, readonly, required, and step content attributes; list, value, valueAsDate, and valueAsNumber IDL attributes; select(), stepDown(), and stepUp() methods.

@udos86
Copy link
Owner

udos86 commented Dec 13, 2016

@JBusch Oh, you're right. I originally thought that min and max attributes would only apply to input type number. Nevertheless you can already set min and max properties for DynamicInputModel.

@JBusch
Copy link
Author

JBusch commented Dec 13, 2016

you can already set min and max properties for DynamicInputModel

well, those on the input model are numbers. we would need dates here though, right?

@udos86
Copy link
Owner

udos86 commented Dec 13, 2016

@JBusch I'm not sure. Shouldn't it be number | string? (see http://www.w3schools.com/tags/att_input_min.asp)

@JBusch
Copy link
Author

JBusch commented Dec 13, 2016

Jap, valid date string is fine. i'll check it out.

@JBusch
Copy link
Author

JBusch commented Dec 13, 2016

Yes, it already works just by setting the min attribute on the input model!

@JBusch JBusch closed this as completed Dec 13, 2016
@JBusch
Copy link
Author

JBusch commented Dec 13, 2016

well, min and max are only number right now, which throws an error:

export interface DynamicInputModelConfig extends DynamicInputControlModelConfig {
    accept?: string;
    inputType?: string;
    list?: Array<string>;
    max?: number;
    min?: number;
    multiple?: boolean;
    pattern?: string;
    step?: number;
}
export declare class DynamicInputModel extends DynamicInputControlModel<any> {
    accept: string | null;
    inputType: string;
    files: FileList | null;
    list: Array<string> | null;
    max: number | null;
    min: number | null;
    multiple: boolean | null;
    pattern: string | null;
    step: number | null;
    private listId;
    readonly type: string;
    constructor(config: DynamicInputModelConfig, cls?: ClsConfig);
}

@JBusch JBusch reopened this Dec 13, 2016
@JBusch
Copy link
Author

JBusch commented Dec 14, 2016

A DynamicDatePickerModel would be really nice btw. Type "date" is so sad right now :(

@udos86
Copy link
Owner

udos86 commented Dec 14, 2016

@JBusch types will be adjusted in the next patch version 1.3.2

@udos86 udos86 closed this as completed in 391101a Dec 17, 2016
@udos86 udos86 added the core label Jan 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants