Custom stylecondition in ag grid cell

I want to change font color of cell once it’s due

cellStyle ={
            "styleConditions": [
                {"condition": f"params.value < '{'%d/%m/%y')}'", "style": {"color": "red"}},

i m getting due date in 01/03/23 format

Hello @Vaishali,

You need to make sure that your data is also in the same format as what you are trying.

You might need to convert them into datetime on the JS side as well, because this could just be comparing the strings.

You might also consider making it so that it is less than or equal to if it is due today.

Can you give an example of conditional style applied on date column in this example

Sure thing, here you go:

Simple column filters - number filter and text filter

import dash_ag_grid as dag
from dash import Dash, html, dcc
import pandas as pd
import datetime as dt

app = Dash(__name__)

df = pd.read_csv(

# basic columns definition with column defaults
columnDefs = [
    {"field": "athlete", "filter": False},
    {"field": "country", "filter": False},
        "headerName": "Date",
        "filter": "agDateColumnFilter",
        "valueGetter": {"function": "d3.timeParse('%d/%m/%Y')("},
        "valueFormatter": {"function": ""},
        "filterParams": {
            "browserDatePicker": True,
            "minValidYear": 2000,
            "maxValidYear": 2021,
            "styleConditions": [
                {"condition": f"params.value < d3.timeParse('%d/%m/%Y')('24/08/2008')",
                 "style": {"color": "red"}},

defaultColDef = {
    "flex": 1,
    "minWidth": 150,
    "filter": True,
    "floatingFilter": True,

app.layout = html.Div(
        dcc.Markdown("Date Filter Example"),
        dag.AgGrid(columnDefs=columnDefs, rowData=df.to_dict("records"), defaultColDef=defaultColDef),
    style={"margin": 20},

if __name__ == "__main__":

@jinnyzor thanks for the solution, this works! Can you also tell me how can I pass today’s date in the condition

You need to replace the string date:'%d/%m/%y')