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

🚀 - Time, DateTime support AM/PM time formats including input of 'am'/'pm' #1169

Open
mduft opened this issue Mar 21, 2024 · 1 comment
Open
Assignees
Labels
feature New feature or request P2 This issue has medium priority scope: kit Related to @maskito/kit

Comments

@mduft
Copy link

mduft commented Mar 21, 2024

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

@maskito/kit

Description

Currently only 24 hour format works out of the box.

I noticed that there is a possibility to override the max values for individual segments, but I still cannot enter 'am' or 'pm' in the input field.

@mduft mduft added the feature New feature or request label Mar 21, 2024
@nsbarsukov nsbarsukov added scope: kit Related to @maskito/kit P2 This issue has medium priority labels Mar 21, 2024
@nsbarsukov nsbarsukov changed the title 🚀 - Allow AM/PM time formats including input of 'am'/'pm' 🚀 - Time supports AM/PM time formats including input of 'am'/'pm' Mar 21, 2024
@nsbarsukov nsbarsukov changed the title 🚀 - Time supports AM/PM time formats including input of 'am'/'pm' 🚀 - Time, DateTime support AM/PM time formats including input of 'am'/'pm' Mar 21, 2024
@KrollikRoddzer
Copy link
Collaborator

KrollikRoddzer commented Apr 19, 2024

Research

While researching different fields for time entry I was able to find two different approaches.

The first is to focus on a specific segment and edit it further. The second is when you can select in a separate am/pm field.

First example: https://mui.com/x/react-date-pickers/adapters-locale/#with-luxon
Second example: https://m3.material.io/components/time-pickers/overview#453a1694-0037-45f8-9421-8899bde1b6ea

We must define options for mask:

  1. "HH:MM TT" (https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings#lowercase-seconds-f-fraction-specifier)
  2. "HH:MM FF" (https://vaadin.com/docs/latest/components/time-picker)
    3 "HH:MM AM/PM"

In specs below I will use FF option.

Specifications of the new feature:

  • Supported Time masks: "HH FF", "HH:MM FF", "HH:MM:SS FF", "HH:MM:SS.MSS FF"

  • In the initial state, as long as the user has not entered anything, there will be AM in the focused input field. If the input field is empty and out of focus, it will be empty.

  • If the cursor is within AM/PM, the up-down arrows will change AM to PM and vice versa.

  • When the cursor is at the end of numeric time segments (HH:MM| FF or HH:MM |FF), pressing a/A will expose AM, pressing p/P will expose PM.

  • AM and PM can be erased if necessary. If the cursor is within AM/PM, then pressing backspace will erase the entire AM/PM segment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request P2 This issue has medium priority scope: kit Related to @maskito/kit
Projects
No open projects
Status: 💡 Backlog
Development

No branches or pull requests

3 participants