mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Merge commit 'refs/pull/37/head' of https://github.com/renerocksai/telekasten.nvim into feature-template-dates
This commit is contained in:
@@ -174,13 +174,13 @@ local function daysuffix(day)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local daymap = {
|
local daymap = {
|
||||||
"Sunday",
|
|
||||||
"Monday",
|
"Monday",
|
||||||
"Tuesday",
|
"Tuesday",
|
||||||
"Wednesday",
|
"Wednesday",
|
||||||
"Thursday",
|
"Thursday",
|
||||||
"Friday",
|
"Friday",
|
||||||
"Saturday",
|
"Saturday",
|
||||||
|
"Sunday",
|
||||||
}
|
}
|
||||||
local monthmap = {
|
local monthmap = {
|
||||||
"January",
|
"January",
|
||||||
@@ -212,8 +212,17 @@ local function calculate_dates(cinfo)
|
|||||||
local df = dateformats
|
local df = dateformats
|
||||||
|
|
||||||
local opts = {}
|
local opts = {}
|
||||||
opts.date = os.date(df.date)
|
|
||||||
local wday = dinfo.wday - 1 -- compensate for 1-indexed os.date output
|
-- this is to compensate for the calendar showing M-Su, but os.date Su is
|
||||||
|
-- always wday = 1
|
||||||
|
local wday = dinfo.wday - 1
|
||||||
|
if wday == 0 then
|
||||||
|
wday = 7
|
||||||
|
end
|
||||||
|
|
||||||
|
opts.year = dinfo.year
|
||||||
|
opts.month = dinfo.month
|
||||||
|
opts.day = dinfo.day
|
||||||
opts.hdate = daymap[wday]
|
opts.hdate = daymap[wday]
|
||||||
.. ", "
|
.. ", "
|
||||||
.. monthmap[dinfo.month]
|
.. monthmap[dinfo.month]
|
||||||
@@ -222,10 +231,8 @@ local function calculate_dates(cinfo)
|
|||||||
.. daysuffix(dinfo.day)
|
.. daysuffix(dinfo.day)
|
||||||
.. ", "
|
.. ", "
|
||||||
.. dinfo.year
|
.. dinfo.year
|
||||||
opts.month = dinfo.month
|
|
||||||
opts.year = dinfo.year
|
|
||||||
opts.day = dinfo.day
|
|
||||||
|
|
||||||
|
opts.date = os.date(df.date, time)
|
||||||
opts.prevday = os.date(df.date, time - oneday)
|
opts.prevday = os.date(df.date, time - oneday)
|
||||||
opts.nextday = os.date(df.date, time + oneday)
|
opts.nextday = os.date(df.date, time + oneday)
|
||||||
opts.week = os.date(df.week, time)
|
opts.week = os.date(df.week, time)
|
||||||
|
|||||||
Reference in New Issue
Block a user