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 · 3 comments · May be fixed by #1708
Open

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

mduft opened this issue Mar 21, 2024 · 3 comments · May be fixed by #1708
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
Contributor

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"
  4. HH:MM AA (https://angular.dev/api/common/DatePipe?tab=usage-notes) 🥇

In specs below I will use A option.

Specifications of the new feature:

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

  • 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| AA or HH:MM |AA), 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.

  • 01 – minimum (including) possible value for hours; 12 – maximum (including) possible value for hours

  • If AM / PM was erased, and user triggers blur of textfield => textfield should be padded with AM postfix

  • 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

UPDATE: last features should not be built-in ones and they could be achieved via maskitoAddOnFocusPlugin / maskitoRemoveOnBlurPlugin or Placeholder

@ColinFrick
Copy link

Is there any progress on this feature?

Thanks for the great work! The lib looks really promising.

@nsbarsukov
Copy link
Member

@ColinFrick
Unfortunately, this feature is still part of our backlog ((

@nsbarsukov nsbarsukov self-assigned this Sep 26, 2024
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

Successfully merging a pull request may close this issue.

4 participants