1

I am using angular 7 and i would like to have an input type with dd-MM-YYYY hh:mm:ss Currently i'm using datetime-local and it's only limited to dd-MM-YYYY hh:mm. For my search i also would like to use ss(seconde). How can i do it? what is the appropriate value for input to have the seconds. Here is my code

<div class="form-inline col-sm-7">
  <div class="form-group mx-sm-3 mb-2">
    <input type="datetime-local" class="form-control" id="date1"  [(ngModel)]="dateBefore"/>
  </div>
  <div class="form-group mx-sm-3 mb-2">
    <input type="datetime-local" class="form-control" id="date2" [(ngModel)]="dateAfter"/>
  </div>
  <button type="submit" class="btn btn-info mb-2" (click)="searchAuditDate()">Chercher</button>
</div>

2 Answers 2

3

In order to use seconds in datetime-local you will have to add step attribute to it.

<input type="datetime-local" class="form-control" id="date1"  [(ngModel)]="dateBefore" step="1"/>
Sign up to request clarification or add additional context in comments.

Comments

2

Adding step attribute will resolve your issue.

<input type=datetime-local value="2013-10-24T20:36:00" step="1">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.