question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Date and Time Mask, while inputting a date without a time

See original GitHub issue

I have a date and time mask, the code is shown below:

$("#element").inputmask({
            mask: "1/2/y h:s:s",
            placeholder: "__/__/____ __:__:__",
            alias: "datetime",
            hourFormat: "24",
            showMaskOnHover: false
        });

Is there a way, that when the user inputs a date without a time, the time placeholder part (hh:mm:ss) is removed. In other words, I wish that the time portion is optional.

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
RobinHerbotscommented, Sep 18, 2014

Try with:

$(“#element”).inputmask({ mask: “1/2/y [h:s:s]”, placeholder: “//____ ::__”, alias: “datetime”, hourFormat: “24”, showMaskOnHover: false });

2014-09-18 9:52 GMT+02:00 jamezamm notifications@github.com:

I have a date and time mask, the code is shown below:

$(“#element”).inputmask({ mask: “1/2/y h:s:s”, placeholder: “//____ ::__”, alias: “datetime”, hourFormat: “24”, showMaskOnHover: false });

Is there a way, that when the user inputs a date without a time, the time placeholder part (hh:mm:ss) is removed. In other words, I wish that the time portion is optional.

Thanks in advance.

— Reply to this email directly or view it on GitHub https://github.com/RobinHerbots/jquery.inputmask/issues/654.

0reactions
RobinHerbotscommented, Sep 18, 2014

Use the greedy: false option

2014-09-18 10:27 GMT+02:00 jamezamm notifications@github.com:

After inputting the date only. The time portion is being removed. But the time portion mask is being shown on hover, even while I have showMaskOnHover: false.

Any thoughts?

— Reply to this email directly or view it on GitHub https://github.com/RobinHerbots/jquery.inputmask/issues/654#issuecomment-56009112 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Date/time masks and format specifiers - IBM
When you declare a TIMESTAMP or INTERVAL variable, you can specify a mask to define the internal format of the variable. EGL carries...
Read more >
Input mask for International Date/Time - Microsoft Community
This for a wage calculation program where the pay clerk enters date/time in the format YYYY-MM-DD HH:nn. To make it easier I tried...
Read more >
Mask Type: DateTime | WinForms Controls
The DateTime mask type allows users to enter a date and/or time. DateTime masks support the Gregorian, Korean, Taiwanese, and Thai Buddhist calendars....
Read more >
Masked Date-Time input without p:calendar - Stack Overflow
With an inputMask component, you can't easily validate the date format, and you have to parse ...
Read more >
Microsoft Access 365 Lesson 2 - Date Input Mask vs Formatting
In this series of videos you will learn how to use the latest version of Microsoft Access as part of the Microsoft Office...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found