nvim: plugin/epoch-converter: Fix timestamp conversion helper
The epoch time under cursor may be in milliseconds or seconds. Use visual selection to select epoch since we won't know which. Else when the epoch was in milliseconds we would just get wrong results.
This commit is contained in:
parent
7e0060eacb
commit
5c80b85d69
1 changed files with 4 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
function GetHumanReadableDate()
|
function GetHumanReadableDate()
|
||||||
let epoch = expand("<cword>")
|
normal! `<v`>y
|
||||||
let date = trim(system("date -d @" . epoch))
|
let date = trim(system("date -d @" . trim(shellescape(@@))))
|
||||||
echo date
|
echo date
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
@ -10,5 +10,5 @@ function GetEpochDate()
|
||||||
echo date
|
echo date
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
nnoremap <LocalLeader>e :call GetHumanReadableDate()<CR>
|
xnoremap <LocalLeader>e :call GetHumanReadableDate()<CR>
|
||||||
xnoremap <LocalLeader>e :call GetEpochDate()<CR>
|
xnoremap <LocalLeader>E :call GetEpochDate()<CR>
|
||||||
|
|
Loading…
Reference in a new issue