Skip to content

datetime: documented parse of time with h.hh or m.mm#5672

Merged
AArdeev merged 1 commit into
tarantool:latestfrom
tmr-g:i5671
May 28, 2026
Merged

datetime: documented parse of time with h.hh or m.mm#5672
AArdeev merged 1 commit into
tarantool:latestfrom
tmr-g:i5671

Conversation

@tmr-g
Copy link
Copy Markdown
Contributor

@tmr-g tmr-g commented May 27, 2026

Closes #5671 ("Parse of time with hour and minute decimal fraction implemented")

Comment on lines +287 to +317
**Implementation details:**

* For format with decimal fraction of the second ([1], 5.3.1.4, a)
the tail after 9 fraciton 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 format with 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 somebody want a second fraction, they must use explicit representation
(format a).

.. 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

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.

Closes tarantool#5671 ("Parse of time with hour and minute decimal
fraction implemented")
@AArdeev AArdeev merged commit bcf3d4c into tarantool:latest May 28, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parse of time with hour and minute decimal fraction implemented

2 participants