ngModle value is not getting reflected in UI for 'ng-pick-datetime' date picker control - datepicker

I am trying to transform ngModel value depends upon current time zone value and binding back to date picker control in Angular UI. (Angular 7)
html:
<input placeholder="Date Time:"[(ngModel)]="dateTime"
(ngModleChange)="updateDate(dateTime)"
[owlDateTimeTrigger]="dt" [owlDateTime]="dt">
<owl-date-time #dt></owl-date-time>
component:
this.datetime= "5/23/2019 8.52 AM EST"
Since <owl-date-time> uses moment.js internally and the date value is selected and bind to input control is type date hence its not accepting string format and not binding back with actual string format:5/23/2019 8.52 AM EST
5/23/2019 8.52 AM EST value hast to be displayed in date picker control.

Related

Safari 15 Desktop. How to set input field 'date' to empty default value

I'm currently working on a html form with input type="date" fields.
Unfortunately Safari 15 sets current date as a default value in every empty date field.
Is there a way to set the default to empty? Like in Chrome dd-mm-yyyy.
Thank you! :)

How to set two way binding for a date object?

I'm trying to implement DatePicker to return a Date Value similar to this example in Angular 6
https://stackblitz.com/angular/klxqgnondlx?file=app%2Fapp.component.html
It works great . . . . . . . but it returns a JSON date rather than Date object, so the two way binding with a corresponding date field doesn't work.
I need the date picker to return Date object not JSON
Here is what I tried
<input class="form-control" type="date" placeholder="yyyy-mm-dd"
id ="myDate" name="myDate" [(ngModel)]="model.myDate| date:'yyyy-mm-dd'" ngbDatepicker #d="ngbDatepicker" (ngModelChange)="myDate= $event" >
But it didn't work
What is returned is up to the library you are using. You could always use a different library. It might be easiest to just make your model a string (representation as JSON date), and convert it to a Date object when you actually need to use the Date representation.

DateFormat for Kendo DatePicker

How can I format Kendo Date picker to MM/dd/yyyy in Angular. Also how can can I remove month/dd/yyyy watermark from date picker
You can bind the DatePicker format input and provide the desired formatting string, e.g.:
<kendo-datepicker
[format]="'MM/dd/yyyy'"
...
></kendo-datepicker>
EXAMPLE
The placeholder comes from the current culture info, and currently cannot be removed, barring some hacks, based on clearing the underlying HTML input element's value programmatically.

How to replace a date in a date list using SSJS in XPages

I have a date list field and need to replace a value in the list with another value
so I have this list of type "date list"
The user enter a new value in a date field in the webpage. This new value should be added to in this case the second item in the date list, but it in the real case it should be able to be added to any position in the list
This is the inputfield where user enter a new date
<xp:inputText id="inputText1">
<xp:this.converter>
<xp:convertDateTime pattern="yyyy-MM-dd"></xp:convertDateTime>
</xp:this.converter>
</xp:inputText>
This is the code I use in my button that should replace the date
doc is a data source on the XPage
var v:java.util.Vector = doc.getDocument().getItemValueDateTimeArray("TDate")
v.setElementAt(getComponent("inputText1").getValue(),1)
doc.replaceItemValue("TDate",v)
doc.save()
Not sure what I am doing wrong here, but I seem to have two problems, first the field only seem to contain one element after I save, and secondly the date that is added contain both date and time, and not only the date
This is the result after running the code
Running the same kind of code using a multivalue "text" field works fine.
how can I modify my code so that my replace operation in the date list works
to set a date value without the time part
get a DateTime object and call the function setAnyTime() on the NDT object and replace the item
to set a specific time value in a multivalue datetime field
get the field you will get a vector with all the datetime object.
Get the specific timedate in the vector change it and set it back to the vector. and after that replace the item

Set initial value of DateInputElement

I need to set intial value for DateInputElement. The .dart file has a variable dob with initial value:
String dob='01/01/2013'
and html has
<input id='mydob' type='date' name='dob' required='true' bind-value='dob'/>
dob is not shown when UI is displayed. The control shows mm/dd/yyyy.
If I select a date on UI, the date value is populated in dob variable.
Although bind-value sets two way binding, still tried setting the value to dob as follows without success:
<input id='mydob' type='date' name='dob' required='true' value={{dob}} bind- value='dob'/>
Also tried the following in life cycle events but did not work:
DateInputElement e = query('#mydob');
e.value=dob;
The format you are trying to put into the field is wrong. It's supposed to be 2013-01-01 (YYYY-MM-DD) according to the RFC. This is completely independent from dart or any other binding.
I would add that it is nessary to have the 0. So it is 2013-01-01 and not 2013-1-1