Webix Date Comparison

How to use following API for date comparison -

if(webix.filters.date.greater(date1, date2)){
/some code/
}

I am using following date format-

webix.Date.dateToStr("%Y/%m/%d %H:%i:%s")

using view:datepicker and with timepicker: true with it.

Hello @pratikshadatir1,

How to use following API for date comparison

Please note that the webix.filters.date.greater can only compare Date objects.
The format in the ui.datepicker config is responsible only for rendering the value. It will still return Date as value (if stringResult is not set), so by default everything will be fine. But if you decided to return value as a string, then you have to convert to Date for comparison.
You can check out the basic example in the following snippet:
https://snippet.webix.com/s0qq4w95

Thank You.
One more doubt is here, that when you open popup 12 hrs format is showing while selecting time from timepicker. But in field 24 hrs time format shown like
2020/09/30 16:06:00
while selecting 4:06 PM is shown. How do I show 2020/09/30 04:06:00 in date field?

@pratikshadatir1,

Please note the difference in format options for %H and %h:

  • %H - the hour based on the 24-hour clock with a leading zero ( 00 to 23 );
  • %h - the hour based on the 12-hour clock with a leading zero ( 00 to 11 );

Please take a look ant the next snippet:
https://snippet.webix.com/tkxnu3vx
For more details, please check our documentation:
https://docs.webix.com/helpers__date_formatting_methods.html