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

🚀 - Date-mask #54

Closed
5 tasks
nsbarsukov opened this issue Jan 10, 2023 · 0 comments · Fixed by #70
Closed
5 tasks

🚀 - Date-mask #54

nsbarsukov opened this issue Jan 10, 2023 · 0 comments · Fixed by #70
Assignees

Comments

@nsbarsukov
Copy link
Member

nsbarsukov commented Jan 10, 2023

Which package(s) are relevant/related to the feature request?

@maskito/kit

Description

We should create mask for InputDate.

Proposed API

import {Maskito} from '@maskito/core';
import {maskitoDateOptionsGenerator} from '@maskito/kit';

const inputDate = new Maskito(
    element,
    maskitoDateOptionsGenerator({
        mode: 'YMD',
        separator: '.',
    })
)

Configurable options

mode

Possible values:

  • DMY - dd.mm.yyyy
  • MDY - mm.dd.yyyy
  • YMD - yyyy.mm.dd

Default value: DMY.

separator

Symbol for separating date-segments (days, months, years).
Default value: . (dot).

min

Accepts native Date.
Validates value ONLY when value is fully completed (after user input).
Default value: null.

max

Accepts native Date.
Validates value ONLY when value is fully completed (after user input).
Default value: null.

Additional requirements for new mask

  • overwriteMode is equal to replace
    2|6.01.2023 => Type 2 => 22.|01.2023

  • when user deletes character in the middle of string
    Acceptable soultion – always replace deleted character with zero.
    26|.01.2023 => Backspace => 2|0.01.2023
    31.05|.2023 => Backspace => 31.0|0.2023
    The best solution (can be done in another issue) – replace deleted character with 0 | 1.
    26|.01.2023 => Backspace => 2|0.01.2023
    31.05|.2023 => Backspace => 31.0|1.2023

  • If user type 4 | 5 | 6 | 7 | 8 | 9 for the first digit of days/months => pad it with zero.
    For example: Empty input => User types 9 => Input's value is 09|

  • Cannot type days more than 31.

  • Cannot type months more than 12.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants