Skip to content

Commit c6e7097

Browse files
committed
Text.TOML: support local date
1 parent 2d413be commit c6e7097

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

autoload/vital/__vital__/Text/TOML.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,10 @@ endfunction
230230
"
231231
" Offset Date-Time
232232
" Local Date-Time
233+
" Local Date
233234
"
234235
function! s:_datetime(input) abort
235-
return s:_consume(a:input, '\d\{4}-\d\{2}-\d\{2}[T ]\d\{2}:\d\{2}:\d\{2}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2}:\d\{2}\)\?')
236+
return s:_consume(a:input, '\d\{4}-\d\{2}-\d\{2}\%([T ]\d\{2}:\d\{2}:\d\{2}\%(\.\d\+\)\?\%(Z\|[+-]\d\{2}:\d\{2}\)\?\)\?')
236237
endfunction
237238

238239
"

test/Text/TOML.vim

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ function! s:suite.__parse__()
425425
call s:assert.same(data.ldt2, '1979-05-27T00:32:00.999999')
426426
endfunction
427427

428+
function! parse.local_date()
429+
let data = s:TOML.parse(join([
430+
\ 'ld1 = 1979-05-27',
431+
\], "\n"))
432+
433+
call s:assert.same(data.ld1, '1979-05-27')
434+
endfunction
435+
428436
function! parse.array()
429437
let data = s:TOML.parse(join([
430438
\ 'integers = [ 1, 2, 3 ]',

0 commit comments

Comments
 (0)