Title: ExtJS 4, how to filter date/time columns to an entire day?
Tags: extjs;extjs4
Question: In an ExtJS grid I am looking for the optimal way to implement a date(day = x) filter on a field that is date with time.
The stock filters work for Before and After but the On filter does not because a date never equals a date time. EG: "01-01-2018 <> 01-01-2018 14:10:10" A date time filter is too specific as I want the entire day's data. What is the best way to implement a grid filter so that the On selection will match against all timestamps on that day regardless of time but still display the date with time? My data is a postgresql timestamp without time zone..
My current fix is to manually convert eq filters to date ranges on the server side but that does not scale well and is likely to create regression errors.
Also I am paginating so I have to filter remotely.
Extjs 4.2 with Cakephp 2.


Here is another answer: I am using the following approach to group a grid by the date, but it should help in your case as well: I add to the model a new field that derives from the original field, and then I group (or you filter) by that field.
name: 'StartDate',
type: 'date'
name: 'StartDateOnly',
convert: function(v, rec) {
return Ext.Date.clearTime(rec.get("StartDate"), true);
Comment for this answer: Can you please tell me how to write `clearTime` for this method since getting issue here in this question https://stackoverflow.com/questions/62275607/date-gettime-is-not-a-functioin-extjs-datefield-column

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2018:00:03/12/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<extjs><extjs4>', 'Title': 'ExtJS 4, how to filter date/time columns to an entire day?', 'ViewCount': 683, 'id': 49238092, 'user_AboutMe': '<p>East Texas cakePHP/extJS developer.</p>\n', 'user_AccountId': 5628580.0, 'user_DisplayName': 'Fong', 'user_Reputation': 105.0, 'user_Views': 7.0, 'user_id': 4456142.0}}