on 2015 Dec 29 12:24 PM
Hi!
I have a button on my form. When I press the button, a new datepicker appears with a default value of 31.12.9999 (31st Dec 9999).
My DatePicker:
new sap.ui.commons.DatePicker({
value: {
path: "oDataModel>/Feevalidto",
type: new sap.ui.model.type.Date({
pattern: "dd.MM.yyyy",
UTC: true, //I need this, because without this, when I changed the value of the datePicker, saved data using oData WebService then the saved date was 1 day less than what I had entered.
strictParsing: true
})
},
change: function () {
//stuff
}
});
I am trying to map a default value using:
dataModel = {
Feevalidto: new Date("9999/12/31")
};
Unfortunately when I press the button the date picker has the value of 30.12.9999.
NOTE:
When I console-d the following:
console.log(new Date("9999/12/31"));
Then I got: Fri Dec 31 9999 00:00:00 GMT+0200 (FLE Standard Time)
Can anyone explain why is this happening and how can I get it to work?
Request clarification before answering.
<DatePicker value="{path: 'fromDate', type: 'sap.ui.model.type.Date', formatOptions: {pattern: 'yyyy/MM/dd', strictParsing: true , UTC: true}}"></DatePicker>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hey luisa92,
Please check the below code and use current date as a UTC date or use Formatter for define UTC
<DatePicker value="{path: 'fromDate', type: 'sap.ui.model.type.Date', formatOptions: {pattern: 'yyyy/MM/dd', strictParsing: true , UTC: true}}"></DatePicker>
Regard
Jai Sharma
Please refer this example code.it should be useful. refer this JS Bin - Collaborative JavaScript Debugging
Kindly let me know if you need any more information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Vijay!
Your code describes a simple DatePicker and a button which gets the value of the date picker. I don't think you understood my question.
My problem is that if I set the "UTC: true" then any value I bind to my model property "Feevalidto" will be changed by 1 day. So if the value bound to my property is new Date("9999/12/31") then the output will be "30.12.9999".
Hopefully you understand my problem a bit more clearly now.
User | Count |
---|---|
41 | |
15 | |
10 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.