Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/documentation/language/datatypes.malloynb
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ Ranges may be used in conjunction with the [apply operator](apply.malloynb) to t

In the future, other ranges may be allowed, such as `string` ranges.

### Duration

Durations can be added to timestamps and dates.

* `@2001-02-03 04:05 + 5 minutes`
* `@2001-02-03 04:05 + myHours hours`
* `@2021-01-01 + 5 weeks`
* `@0000-01-01 + myYear years + (daysIntoMyYear - 1) days`

Comment on lines +129 to +137
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for starting this.

A few notes.

  1. Durations can be added or subtracted.
  2. The legal units for durations are, i think, microseconds, milliseconds, seconds, minutes, hours, days, weeks.
  3. SQL durations, if the database has them, are not imported and useful as Malloy durations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I added years to your list of legal units 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also modified point3 for clarity.

A few notes:

1. Durations can be added or subtracted.

2. The legal units for durations are: microseconds, milliseconds,
seconds, minutes, hours, days, weeks, years.

3. SQL durations, if the database has them, are not imported and cannot be used
as Malloy durations.

### Alternations and Partials

_Partials_ represent a "part of" a comparison.
Expand Down