gristlabs_grist-core/sandbox/grist/functions
Alex Hall 083a0ec000 (core) Allow using MIN and MAX functions with dates/datetimes
Summary:
The MIN and MAX functions for formulas previously only considered numbers, ignoring other types, including dates. An example of this being a problem is here: https://community.getgrist.com/t/last-field-circularreferror-what-is-it/1114/4 . Using `MIN` on a column of dates would return 0 (the default) which gets converted to 1970-01-01. Users have to use `min` instead, which is confusing, and doesn't work when some values are empty.

This diff lets the functions operate on date and datetime values. A mixture of dates and datetimes is allowed, even though these cannot usually be compared in Python. Mixing dates and numbers will raise an exception.

Test Plan: Extended doctests

Reviewers: jarek, paulfitz

Reviewed By: jarek

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D3560
2022-08-09 13:34:22 +02:00
..
__init__.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
date.py (core) Update the current time in formulas automatically every hour 2022-04-28 21:07:40 +02:00
info.py (core) External requests 2022-06-17 21:53:20 +02:00
logical.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
lookup.py (core) Add a row to summary tables grouped by list column(s) corresponding to empty lists 2022-06-09 23:38:14 +02:00
math.py (core) Allow using MIN and MAX functions with dates/datetimes 2022-08-09 13:34:22 +02:00
schedule.py (core) New type conversion in the backend 2022-02-04 20:28:13 +02:00
stats.py (core) Allow using MIN and MAX functions with dates/datetimes 2022-08-09 13:34:22 +02:00
test_schedule.py (core) Simple Python 3 compatibility changes 2021-06-22 17:13:17 +02:00
text.py Tweaks to documentation comments for user-facing Grist functions (#126) 2022-02-13 00:45:24 -05:00
unimplemented.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00