Skip to content
Merged
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
33 changes: 33 additions & 0 deletions doc/reference/reference_lua/datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,37 @@ Functions
:return: a number of parsed characters
:rtype: number

**Implementation details:**

* For formats with a decimal fraction of the second ([1], 5.3.1.4, a)
the tail beyond 9 fracitonal digits is truncated.

.. code-block:: tarantoolsession

tarantool> datetime.parse('2024-07-31T17:30:00.123456789999', {format = 'iso8601'})
---
- 2024-07-31T17:30:00.123456789Z
- 32
...

* For formats with a decimal fraction of the hour ([1], 5.3.1.4, c)
or minute ([1], 5.3.1.4, b) fractions are truncated to seconds precision.
If second fractions are desired, explicit representation (format a) must be used.

.. code-block:: tarantoolsession

tarantool> datetime.parse('2024-07-31T17,333333333', {format = 'iso8601'})
---
- 2024-07-31T17:19:59Z
- 23
...

tarantool> datetime.parse('2024-07-31T17:30.333333333', {format = 'iso8601'})
---
- 2024-07-31T17:30:19Z
- 26
...
Comment on lines +287 to +316
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

**Implementation details:**

*  For formats with a decimal fraction of the second ([1], 5.3.1.4, a)
    the tail beyond 9 fracitonal digits is truncated.

    ..  code-block:: tarantoolsession

        tarantool> datetime.parse('2024-07-31T17:30:00.123456789999', {format = 'iso8601'})
        ---
        - 2024-07-31T17:30:00.123456789Z
        - 32
        ...

*  For formats with a decimal fraction of the hour ([1], 5.3.1.4, c)
    or minute ([1], 5.3.1.4, b) fractions are truncated to seconds precision.
    If second fractions are desired, explicit representation (format a) must be used.

    ..  code-block:: tarantoolsession

        tarantool> datetime.parse('2024-07-31T17,333333333', {format = 'iso8601'})
        ---
        - 2024-07-31T17:19:59Z
        - 23
        ...

        tarantool> datetime.parse('2024-07-31T17:30.333333333', {format = 'iso8601'})
        ---
        - 2024-07-31T17:30:19Z
        - 26
        ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Fixed.


**Example:**

.. code-block:: tarantoolsession
Expand Down Expand Up @@ -1211,6 +1242,8 @@ Limitations
References
----------

* [1] `ISO 8601-1:2019: Date and time — Representations for information interchange. Part 1: Basic rules <https://www.iso.org/standard/70907.html>`_

* `RFC 3339: Date and Time on the Internet: Timestamps <https://www.rfc-editor.org/rfc/rfc3339>`_

* `ISO 8601: Date and time format <https://www.iso.org/iso-8601-date-and-time-format.html>`_
Expand Down
Loading