Skip to content

Commit ba78d12

Browse files
committed
Add description of the totable() method for an interval object; correct the list of the datetime functions and methods
Part of #2835
1 parent 42f0f5a commit ba78d12

File tree

5 files changed

+99
-8
lines changed

5 files changed

+99
-8
lines changed

doc/reference/reference_lua/datetime.rst

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,26 @@ Below is a list of the ``datetime`` module functions and methods.
2828
* - :ref:`format() <datetime-format>`
2929
- Convert the standard presentation of a ``datetime`` object into a formatted string.
3030

31-
* - :ref:`totable() <datetime-totable>`
31+
* - :ref:`datetime_object:totable() <datetime-totable>`
3232
- Convert the information from a ``datetime`` object into the table format.
3333

3434
* - :ref:`set() <datetime-set>`
3535
- Update the field values in the existing ``datetime`` object.
3636

37+
* - :ref:`parse() <datetime-parse>`
38+
- Convert an input string with the date and time information into a ``datetime`` object.
39+
40+
* - :ref:`add() <datetime-add>`
41+
- Modify an existing datetime object by adding ... [TBD]
42+
43+
* - :ref:`sub() <datetime-sub>`
44+
- Modify an existing datetime object by subtracting ... [TBD]
45+
3746
* - :doc:`./datetime/interval_new`
3847
- Create an ``interval`` object from a table of time units.
3948

49+
* - :ref:`interval_object:totable() <interval-totable>`
50+
- Convert the information from an ``interval`` object into the table format.
4051

4152
.. toctree::
4253
:hidden:

doc/reference/reference_lua/datetime/datetime_object.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ datetime_object
1111

1212
.. method:: totable()
1313

14-
Convert the information from the ``datetime`` object into the table format.
14+
Convert the information from a ``datetime`` object into the table format.
1515
Resulting table has the following fields:
1616

1717
.. container:: table
@@ -245,7 +245,7 @@ datetime_object
245245
246246
.. _datetime-add:
247247

248-
.. method:: add( { input[, adjust ] } )
248+
.. method:: add( input[, { adjust } ] )
249249

250250
Modify an existing datetime object by adding values of the input argument. [TBD]
251251

doc/reference/reference_lua/datetime/interval_new.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
datetime.interval.new()
44
=======================
55

6-
.. function:: datetime.interval.new( [{ units }] )
6+
.. function:: datetime.interval.new( [{ input }] )
77

88
Since :doc:`2.10.0 </release/2.10.0>`.
99

1010
Create an object of the :ref:`interval type <index-box_interval>` from a table of time units.
1111
See :ref:`description of units <interval-new-args>` and :ref:`examples <interval-new-example>` below.
1212

13-
:param table units: Table of :ref:`time units <interval-new-args>`. For all possible time units, the values are not restricted.
13+
:param table input: Table with :ref:`time units and parameters<interval-new-args>`. For all possible time units, the values are not restricted.
1414
If an empty table or no arguments are passed, the ``interval`` object with the default value ``0 seconds`` is created.
1515

1616
:return: :doc: interval object
1717
:rtype: cdata
1818

1919
.. _interval-new-args:
2020

21-
**Possible input time units for ``datetime.interval.new()**
21+
**Possible input time units and parameters for ``datetime.interval.new()**
2222

2323
.. container:: table
2424

@@ -68,10 +68,15 @@ datetime.interval.new()
6868
- 0
6969

7070
* - year
71-
- Year
71+
- Year. ... [TBD year range and huge year number support]
7272
- number
7373
- 0
7474

75+
* - adjust
76+
- ... [TBD]
77+
- string
78+
- 'none'
79+
7580
.. _interval-new-example:
7681

7782
**Examples:**
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
.. _inverval_object:
2+
3+
inverval_object
4+
===============
5+
6+
.. class:: interval_object
7+
8+
Since :doc:`2.10.0 </release/2.10.0>`.
9+
10+
.. _inverval-totable:
11+
12+
.. method:: totable()
13+
14+
Convert the information from an ``interval`` object into the table format.
15+
Resulting table has the following fields:
16+
17+
.. container:: table
18+
19+
.. list-table::
20+
:widths: 30 70
21+
:header-rows: 1
22+
23+
* - Field name
24+
- Description
25+
26+
* - nsec
27+
- Nanosecods
28+
29+
* - sec
30+
- Seconds
31+
32+
* - min
33+
- Minutes
34+
35+
* - hour
36+
- Hours
37+
38+
* - day
39+
- Day number
40+
41+
* - month
42+
- Month number
43+
44+
* - year
45+
- Year
46+
47+
* - week
48+
- Week number
49+
50+
* - adjust
51+
- ... [TBD]
52+
53+
:return: table with the date and time parameters
54+
:rtype: table
55+
56+
**Example:**
57+
58+
.. code-block:: tarantoolsession
59+
60+
tarantool> iv = datetime.interval.new{month = 1, adjust = 'last'}
61+
---
62+
...
63+
64+
tarantool> iv:totable()
65+
---
66+
- adjust: last
67+
sec: 0
68+
nsec: 0
69+
day: 0
70+
week: 0
71+
hour: 0
72+
month: 1
73+
year: 0
74+
min: 0
75+
...

doc/reference/reference_lua/datetime/new.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ datetime.new()
6363
- 1
6464

6565
* - year
66-
- Year
66+
- Year. ... [TBD year range and huge year number support]
6767
- number
6868
- 1970
6969

0 commit comments

Comments
 (0)