I have an input field as shown in below html code.
<div class="input-group input-group-md">
<input id="date"
name="date"
[readOnly]="disabled"
type="text"
placeholder="M0/d0/0000 Hh:m0:s0"
[placeholder]="placeholderSet"
class="form-control"
data-toggle="tooltip"
title="{{tooltipSet}}"
(focus)="changePlaceholderOnFocus()"
(focusout)="changePlaceholderOffFocus()"
[(ngModel)]="searchInput"
(input)="setSelectedDate()"
[owlDateTime]="dt"
>
<div class="input-group-append">
<span class="fa fa-calendar input-group-text"
[owlDateTimeTrigger]="dt">
</span>
</div>
</div>
<owl-date-time
[disabled]="disabled"
[startAt]=""
[showSecondsTimer]="true"
#dt>
</owl-date-time>
I want raw text entered in the input field i.e., when I enter date like 12/12/2020 12:13:56 in input box, I get date like Sat Dec 12 2020 12:13:56 GMT+0530 (India Standard Time) in the code instead of mm/dd/yyyy hh:mm:ss format that I entered in the input box. I want to get as it is data from input box weather it is date or not. I AM USING OwlDateTime PICKER.
Below is the ts code.
export class DateTimePickerComponent implements OnInit, OnDestroy {
@Input() disabled: any;
@Input() placeholderSet: any;
@Input() tooltipSet: any;
@Input() selectedDropDown: any;
@Input()
parentSubject: Subject<any>;
searchInput: string;
temp: any;
constructor() {
}
@Output() selectedDate = new EventEmitter<any>();
setSelectedDate() {
this.searchInput = String(this.searchInput);
this.selectedDate.emit(this.searchInput);
}
You can see the searchInput is string. You can also check in the attached screen shot that it is converting it to proper js date format.
