Commit Briefs

f956ff516b Sergey Bronnikov

datetime: introduce tz in datetime.parse() (ligurio/gh-10420-datetime.parse-tz)

There is an option tz in `datetime.parse()`, it was added in commit 3c40366172e3 ("datetime, lua: date parsing functions"). The option is not documented, and the commit message says that option `tz` is "Not yet implemented in this commit.". The patch added tests and a doc request for this option. The behaviour of the option `tz` is the same as with option `tzoffset`: - if timezone was not set in a parsed string then it is set to a value specified by `tz` - if timezone was set in a parsed string then option `tz` is ignored ``` tarantool> date.parse("1970-01-01T01:00:00 MSK", { tz = 'Europe/Paris' }) --- - 1970-01-01T01:00:00 MSK - 23 ... tarantool> date.parse("1970-01-01T01:00:00", { tz = 'Europe/Paris' }) --- - 1970-01-01T01:00:00 Europe/Paris - 19 ... ``` Follows up #6731 Fixes #10420 @TarantoolBot document Title: Introduce option `tz` in `datetime.parse()` The option `tz` is added in a function `datetime.parse()`. The option set timezone to a passed value if it was not set in a parsed string.


04811e032f Sergey Kaplun

datetime: use tzoffset in a parse() with custom format

The patch fixes a behaviour, when `datetime.parse()` ignores `tzoffset` option if custom format is used. Fixes #8333 Relates to #10420 NO_DOC=bugfix


d7d3063fbd Sergey Kaplun

refactoring: datetime_parse_full drop parse offset

The patch refactors a function `datetime_parse_full()` - overriding of timezone is not a part of datetime string parsing and this part was removed. Needed for #8333 NO_CHANGELOG=refactoring NO_DOC=refactoring NO_TEST=refactoring


f57be571b5 Sergey Kaplun

sql: forbid non-integer values in datetime

The patch forbids using non-integer values in datetime's `:set()` for `year`, `month`, `day`, `hour`, `min`, `sec`, `usec`, `msec`, `nsec` and `tzoffset` keys. `timestamp` can be double, and integer values allowed in timestamp if `nsec`, `usec`, or `msecs` provided. An error will be raised when a value of incorrect type is passed. Fixes #10391 @TarantoolBot document Title: Update types of datetime values passed to SQL's `CAST();` `CAST` can accept only integer values for `year`, `month`, `day`, `hour`, `min`, `sec`, `usec`, `msec`, `nsec` and `tzoffset`. `timestamp` can be integer or double.


6e77907baa Sergey Kaplun

datetime: forbid non-integers in :set() and parse()

The patch forbids using non-integer values in datetime's `:set()` for `year`, `month`, `day`, `hour`, `min`, `sec`, `usec`, `msec` and `nsec` keys. The type of `tzoffset` can be integer or string, `timestamp` can be double, and integer values allowed in timestamp if `nsec`, `usec`, or `msecs` provided. An error will be raised when a value of incorrect type is passed. Part of #10391 @TarantoolBot document Title: Update types of values passed to `:set()` and parse() `:set()` can accept only integer values for `year`, `month`, `day`, `hour`, `min`, `sec`, `usec`, `msec` and `nsec`. The type of `tzoffset` can be integer or string, `timestamp` can be integer or double. `tzoffset` passed to `datetime.parse()` can be integer or string.