I want to use the icu_date library, but when I try to insert a value, an error appears
icu_date = require("icu-date")
format_date = icu_date.formats.iso8601()
end_time = icu_date.now()
1602586287098 - print value
end_time:set_millis(1602461532000)
error: '[string "return end_time:set_millis(1602461532000)"]:1: attempt to index global ''end_time'' (a number value)'
Maybe there are not enough libraries?
Seems you need to use icu_date.new()
(not now
) to create new instance. Then you can use it in the way you want:
icu_date = require("icu-date")
format_date = icu_date.formats.iso8601()
end_time = icu_date.new()
end_time:set_millis(1602461532000)
tarantool> end_time:format(format_date)
---
- 2020-10-12T00:12:12.000Z
...
icu_date.now()
returns current time. That's actually a number value.
tarantool> icu_date = require('icu-date')
---
...
tarantool> icu_date.now()
---
- 1602597687320
...