Add weekday to get_date_string
This commit is contained in:
parent
7ed6023d1b
commit
7f0e9f6e87
2
API.md
2
API.md
@ -102,6 +102,8 @@ Ordinal values:
|
||||
Other:
|
||||
* `%b`: Full name of current month
|
||||
* `%h`: Short name of current month
|
||||
* `%W`: Full name of current weekday
|
||||
* `%w`: Short name of current weekday
|
||||
* `%z`: Literal percent sign
|
||||
|
||||
### `calendar.register_holiday(def)`
|
||||
|
5
init.lua
5
init.lua
@ -142,6 +142,7 @@ calendar.get_date_string = function(format, total_days)
|
||||
end
|
||||
|
||||
local y, m, d, j = calendar.get_date(total_days)
|
||||
local w = calendar.get_weekday(total_days)
|
||||
|
||||
-- cardinal values
|
||||
format = string.gsub( format, "%%Y", y ) -- elapsed years in epoch
|
||||
@ -158,8 +159,8 @@ calendar.get_date_string = function(format, total_days)
|
||||
format = string.gsub( format, "%%b", S(calendar.month_names[ m + 1 ]) ) -- current month long name
|
||||
format = string.gsub( format, "%%h", S(calendar.month_names_short[ m + 1 ]) ) -- current month short name
|
||||
|
||||
format = string.gsub( format, "%%b", S(calendar.month_names[ m + 1 ]) ) -- current month long name
|
||||
format = string.gsub( format, "%%h", S(calendar.month_names_short[ m + 1 ]) ) -- current month short name
|
||||
format = string.gsub( format, "%%W", S(calendar.weekday_names[ w + 1 ]) ) -- current weekday long name
|
||||
format = string.gsub( format, "%%w", S(calendar.weekday_names_short[ w + 1 ]) ) -- current weekday short name
|
||||
|
||||
format = string.gsub( format, "%%z", "%%" )
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user