CartoDB / carto-vl

CARTO VL: a Javascript library to create vector-based visualizations
BSD 3-Clause "New" or "Revised" License
129 stars 26 forks source link

Date properties and expressions #523

Open davidmanzanares opened 6 years ago

davidmanzanares commented 6 years ago

To improve precision, all date properties are re-mapped to the [0,1] range. This makes all arithmetic operations to be unimplemented (I don't know right now if at least we are throwing a type-check error if the user tries).

The only way right now to work around this issue is to use linear() since it has the re-mapping logic. For example, to check that a date property is within today you'll need a hack like:

between(linear($date, firstSecondOfToday, lastSecondOfToday), 0.01, 0.99)

davidmanzanares commented 6 years ago

I think that we could start by implementing between for dates and implement more expressions if users request those features.

davidmanzanares commented 6 years ago

I had seconds thoughts about this now, implementing it partially could confuse users, implementing it completely is a major change and will require much time.

rochoa commented 6 years ago

Let's review this issue in the context of https://github.com/CartoDB/carto-vl/issues/551.