Jquery input mask to input date range

73
September 23, 2019, at 00:10 AM

I am making a web app which should accept a specific interval that is added to the target date to check if the request is expired. So I need an input with formatting: months:days:hours

Where months is limited to 12, days to 31, and hours to 24. I tried to use jQuery inputmask plugin

I made like this:

https://jsfiddle.net/qahxvspb/2/

But it doesn't work for some reason, I put a mask like this:

mask: "mm-dd-hh"

But in the input I get weird stuff, there is still placeholder mm-dd-yyyy, and I only can input year into it.

So 2 questions:

  1. How to make a correct mask?
  2. How can I make allow zero month in the mask? So, basically, it would be optional for the range, if I want I would just put 0 into month, check that on server, and create a range only from days and hours.
Answer 1

Javascript Date makes my head hurt because of things like what you are trying to do

I use a library called moment,which is available as a cdn or npm package

It can create input patterns like the one you have, do arithmetic on dates and then convert to the time format you want, even Javascript Date

READ ALSO
React Horizontal List with Styled Components

React Horizontal List with Styled Components

I am trying to make a horizontal scrollable list in React with Styled ComponentsEach list item is a fairly complex React component

99
How can I make an image/video fit to smaller screen?

How can I make an image/video fit to smaller screen?

In an image tag I need to keep the width 600px and I keep the height 100%I cannot keep the width 960px as it will be too big in the bigger screen

65
sql update where subquery

sql update where subquery

My exercise is:

75