Taragolis opened a new issue, #35500:
URL: https://github.com/apache/airflow/issues/35500

   ### Discussed in https://github.com/apache/airflow/discussions/35430
   
   <div type='discussions-op-text'>
   
   <sup>Originally posted by **Gollum999** November  3, 2023</sup>
   ### Apache Airflow version
   
   2.7.2
   
   ### What happened
   
   On the "Details" tab on a DAGs "Grid" page, all numeric DAG attributes are 
rendered as timestamps instead of numbers.  For example:
   
   
![image](https://github.com/apache/airflow/assets/7269927/9a99ccab-2d20-4a57-9fa8-63447e14444b)
   
   I have noticed this behavior with the following fields, though there may be 
more:
   * Max active runs
   * Max active tasks
   * Concurrency
   
   ### What you think should happen instead
   
   Numeric fields should be rendered as numbers.
   
   ### How to reproduce
   
   Go to any DAG's Grid page.  Don't select a DAG Run or Task Instance.  Click 
the Details tab if it is not already selected.
   
   ### Operating System
   
   CentOS Stream 8
   
   ### Versions of Apache Airflow Providers
   
   N/A
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   Standalone + self-hosted
   
   ### Anything else
   
   I think the bug is 
[here](https://github.com/apache/airflow/blob/0a257afd031289062c76e7b77678337e88e10b93/airflow/www/static/js/dag/details/Dag.tsx#L133):
   ```
     // parse value for each key if date or not
     const parseStringData = (value: string) =>
       Number.isNaN(Date.parse(value)) ? value : <Time dateTime={value} />;
   ```
   `Date.parse(1)` returns a number that is not NaN.
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   </div>
   
   ---
   
   Reopen after discussion, and [additional 
findings](https://github.com/apache/airflow/discussions/35430#discussioncomment-7473103):
   
   - Seems like it is only affect WebKit-based browsers, and works fine in 
Firefox
   - Not all integers transformed into the dates, at least in range 13..31 keep 
integer type, and default value for  `Max active runs`, `Max active tasks` is 
16 that might be the reason why this bug remained unnoticed
   
   
   Example DAG for reproduce
   
   ```python
   import pendulum
   
   from airflow.models.dag import DAG
   from airflow.operators.empty import EmptyOperator
   
   num_to_dt = {
       1: True,
       8: True,
       12: True,
       # 13-31 shows fine
       **{ix: False for ix in range(13, 32)},
       32: True,
       64: True,
       128: True,
       256: True,
   }
   
   for num, convert_to_dt in num_to_dt.items():
       with DAG(
           f"issue_35430_number_{num:03d}",
           start_date=pendulum.datetime(2023, 6, 1, tz="UTC"),
           schedule=None,
           catchup=False,
           max_active_runs=num,
           max_active_tasks=num,
           tags=["issue", "35430", "ui", f"int to dt: {convert_to_dt}", 
str(num)]
       ):
           EmptyOperator(task_id="empty", retries=num)
   ```
   
   
   ### Committer
   
   - [X] I acknowledge that I am a maintainer/committer of the Apache Airflow 
project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to