Skip to content

document new temporal datatypes #167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
125 changes: 125 additions & 0 deletions datatypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,131 @@ Since we cannot reason broadly about unknown values, `null` is an important part

Unlike all other scalars, `null` cannot be stored as a property value.

## Temporal Types
FalkorDB supports the following temporal types that allow modeling and querying time-related data:

## 1. [Date](#Date)

## 2. [Time](#Time)

## 3. [DateTime](#DateTime)

## 4. [Duration](#Duration)

Comment on lines +108 to +115
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid internal anchor links to satisfy markdownlint (MD051).

The link fragments are capitalized (#Date, #Time, …) while the autogenerated IDs for the headings are lowercase (#date, #time, …).
This breaks in-page navigation and causes the lint failure reported in the pipeline.

-## 1. [Date](#Date)
-## 2. [Time](#Time)
-## 3. [DateTime](#DateTime)
-## 4. [Duration](#Duration)
+## 1. [Date](#date)
+## 2. [Time](#time)
+## 3. [DateTime](#datetime)
+## 4. [Duration](#duration)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## 1. [Date](#Date)
## 2. [Time](#Time)
## 3. [DateTime](#DateTime)
## 4. [Duration](#Duration)
## 1. [Date](#date)
## 2. [Time](#time)
## 3. [DateTime](#datetime)
## 4. [Duration](#duration)
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

108-108: Link fragments should be valid
Expected: #date; Actual: #Date

(MD051, link-fragments)


110-110: Link fragments should be valid
Expected: #time; Actual: #Time

(MD051, link-fragments)


112-112: Link fragments should be valid
Expected: #datetime; Actual: #DateTime

(MD051, link-fragments)


114-114: Link fragments should be valid
Expected: #duration; Actual: #Duration

(MD051, link-fragments)

🤖 Prompt for AI Agents
In datatypes.md around lines 108 to 115, the internal anchor links use
capitalized fragments like #Date and #Time, but the actual heading IDs are
lowercase. Update all anchor links to use lowercase fragments (#date, #time,
etc.) to match the autogenerated heading IDs and fix the markdownlint MD051
error.

These types follow the ISO 8601 standard and can be used in properties, parameters, and expressions.

### Date

Represents a calendar date in the format YYYY-MM-DD.

Purpose
Use Date to store and compare dates without time information, e.g. birth dates, due dates, or deadlines.

```cypher
CREATE (:Event { name: "Conference", date: date("2025-09-15") })
```

#### Interactions
* Compare using operators (=, <, >, etc.)

* Extract components using functions:

```cypher
RETURN date("2025-09-15").year // 2025
RETURN date("2025-09-15").month // 9
RETURN date("2025-09-15").day // 15
```

### Time

Represents a time of day, in the format hh:mm:ss.

Purpose
Use Time to store specific times (e.g. store hours, alarm times) without date context.

```cypher
CREATE (:Reminder { msg: "Wake up!", at: localtime("07:00:00") })
```

#### Interactions

* Compare time values:

```cypher
RETURN localtime("07:00:00") < localtime("09:30:00") // true
```

* Extract parts:

```cypher
RETURN localtime("15:45:20").hour // 15
RETURN localtime("15:45:20").minute // 45
RETURN localtime("15:45:20").second // 20
```

### DateTime

Represents a point in time, combining both date and time. Format: YYYY-MM-DDTHH:MM:SS.

Purpose
Use DateTime when both date and time are relevant, e.g. logging events, scheduling, timestamps.

Example
```cypher
CREATE (:Log { message: "System rebooted", at: localdatetime("2025-06-29T13:45:00") })
```

#### Interactions

* Compare with other DateTime values

* Extract parts:

```cypher
RETURN localdatetime("2025-06-29T13:45:00").year // 2025
RETURN localdatetime("2025-06-29T13:45:00").hour // 13
```

* Use localdatetime() with no arguments to get the current system time:

```cypher
RETURN localdatetime()
```

### Duration

Represents a span of time. Format: P[n]Y[n]M[n]DT[n]H[n]M[n]S (ISO 8601 Duration).

Purpose
Use Duration to represent intervals, e.g. "3 days", "2 hours", or "1 year and 6 months".

Example
```cypher
CREATE (:Cooldown { period: duration("P3DT12H") })
```

#### Interactions

* Add/subtract durations with dates or datetimes:

```cypher
RETURN date("2025-01-01") + duration("P1M") // 2025-02-01
RETURN datetime("2025-06-29T13:00:00") - duration("PT30M") // 2025-06-29T12:30:00
```

* Add durations together:

```cypher
RETURN duration("P1D") + duration("PT12H") // P1DT12H
```

* Extract fields:

```cypher
RETURN duration("P1Y2M3DT4H5M6S").years // 1
RETURN duration("P1Y2M3DT4H5M6S").hours // 4
```

## Collection types

### Arrays
Expand Down
Loading