cancel
Showing results for 
Search instead for 
Did you mean: 

Time validation

0 Kudos

I have 4 fields.

1. Start Time

2.End Time

3.Break start time

4.Break end time

validation rules :

1.Here startTime should not greater than endTime.

2.breakTime should not lesser than startTime and should not greater than breakEndTime and endTime.

3.breakStartTime and breakEndTime should be within the range of startTime and Endtime.

4.breakEndTime should not be less than startTime, breakStartTime and should not be greater than endTime.

5. These all four times hould be compared after converting the actual time to epoch.

I'm new to openui5. I kindly request community to help

Accepted Solutions (1)

Accepted Solutions (1)

former_member560141
Participant

To get the time from a date input in SAPUI5 you can do something like this

//Javascript date obj
var date1 = this.getView().byId("date-input-id1").getDateValue();
var date2 = this.getView().byId("date-input-id2").getDateValue();
//Parse just incase.
if(Date.parse(date1) < Date.parse(date2)){ //Date 1 smaller that date 2 }

https://sapui5.hana.ondemand.com/#/api/sap.m.DatePicker/methods/Summary


https://blog.udemy.com/javascript-date-comparison/

Answers (2)

Answers (2)

maheshpalavalli
Active Contributor

H Pavankumar A N,

Like saurabh vakil mentioned, you need to tell us the issue, this is more like a requirement rather than an issue you are facing.

Try exploring more in sap blogs/questions regarding your query like how to get the time from the UI5 control and your question is more related to Javascript than ui5.. Check Stackoverflow on how to compare times & dates..

After that, when you implement your solution, if you get any issue than we can discuss here..

BR,

Mahesh

saurabh_vakil
Active Contributor

Would appreciate it if you can let us know what you have tried so far and where are you getting stuck?