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

Formatting and Parsing Date/Time Value #2402

Closed
hkvstore opened this issue Sep 13, 2021 · 2 comments
Closed

Formatting and Parsing Date/Time Value #2402

hkvstore opened this issue Sep 13, 2021 · 2 comments

Comments

@hkvstore
Copy link
Contributor

hkvstore commented Sep 13, 2021

Currently the date is formatted by the format() method of the DateTime class:

  format(template: DateTimeFormatOptions, locale = this.locale): string {
    return new Intl.DateTimeFormat(locale, template).format(this);
  }

and when the input field changes, the input value is parsed by the static method OptionConverter._dateTypeCheck:

    let parsedDate = OptionConverter._dateTypeCheck(this._input.value);

It is hard to customize, is it possible to provide more flexibility? For example, can they be options? e.g.

    inputFormat: DateTimeFormatOptions | any;
    format: (DateTime, DateTimeFormatOptions | any, string) => string; // value, inputFormat, locale
    parse: (any, DateTimeFormatOptions | any, string) => DateTime | null; // value, inputFormat, locale
@Eonasdan
Copy link
Owner

looks related to #2387. I already have some incoming code that should make the input parse behave better. Version 5 had a parseInputDate option that allowed for a custom parser for input values. I'm thinking about adding several hooks like painting the cells (e.g. unavailable appointment days)

Eonasdan added a commit that referenced this issue Oct 7, 2021
@Eonasdan
Copy link
Owner

Eonasdan commented Oct 7, 2021

Hello thanks for the report. Please check the comments in #2403. I'm going to close this one so I don't have to track this in to places.

@Eonasdan Eonasdan closed this as completed Oct 7, 2021
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

2 participants