Skip to content

Neovim plugin for converting between Julian date and epoch timestamp.

Notifications You must be signed in to change notification settings

alexpresthus/julian.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

julian.nvim

A personal nvim plugin for converting between Julian date and epoch timestamp.

Note that this plugin in written for me, for a custom use case, and is not intended for a general purpose. It is public in case it might prove helpful for anyone else struggling with the horrors of Julian date representations.

Installation

  • Neovim 0.7.0+ required
  • Install using your favorite plugin manager
  • Example using lazy.nvim
{
    "alexpresthus/julian.nvim"
}

Setup (optional)

If you want to configure default keymaps, run require'julian'.setup(). Using lazy.nvim:

{
    "alexpresthus/julian.nvim",
    opts = {}
}

This will configure the keymaps:

vim.keymap.set("n", "<leader>jdf", function()
    local julian_date = vim.fn.input("Enter Julian date: ")
    return M.julian_to_epoch(julian_date)
end)
vim.keymap.set("n", "<leader>jdt", function()
    local epoch_time = vim.fn.input("Enter epoch time: ")
    return M.epoch_to_julian(epoch_time)
end)

Functions

julian.julian_to_epoch

Converts a Julian date to an epoch timestamp (milliseconds).

require'julian'.julian_to_epoch(2460300)
Julian: 2460300 -> Epoch: 1703160000000 
require'julian'.julian_to_epoch(2460368.365544)
Julian: 2460368.365544 -> Epoch: 1709066783002

julian.epoch_to_julian

Converts an epoch timestamp (milliseconds) to a Julian date.

require'julian'.epoch_to_julian(1709066783002)
Epoch: 1709066783002 -> Julian: 2460368.365544

About

Neovim plugin for converting between Julian date and epoch timestamp.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages