Festival of ASCII-art lights
Mathematica, 376 338 334 bytes
a=Rest@$ScriptCommandLine;b=CalendarConvert[If[a=={},Now~TimeZoneConvert~0,DateObject[FromDigits/@a,TimeZone->0]],j="Jewish"];c=Floor@DateDifference[DateObject[{b[[1,1]],9,25},CalendarType->j,TimeZone->0],b][[1]];d=If[#<=c,"*"," "]&;0<=c<8&&Print[" *
"<>{d/@{7,6,5,4},"|",d/@{3,2,1},"*
|||||||||
|||||||||
+++++++++
|
-+-"}]
Runs in a script.
R, 467 bytes
With a little doubt if using a library for the Calendar conversion is allowed or not.
library(ConvCalendar)
f='%Y %m %d %H %M %S'
g='hebrew'
s=' '
if(length(n<-scan())!=6)n=format(Sys.time(),f)
if(n[4]>17)n[3]=n[3]+1
d=strptime(paste(n,collapse=s),f)
h=as.OtherDate(d,g)
i=OtherDate(25,3,h$year,g)
j=round(difftime(d,as.Date(i),,"days"))+1
N=ifelse(j>0&j<10,(1:9)[j],0)
if(!N)write('')else{l='**||+|+'
z=matrix(strsplit(l,'')[[1]],9,7,T)
z[c(1:4,6:9),c(1,6:7)]=s
z[c(4,6),7]='-'
if(N<8)z[1:(9-N),2:4]=s
z[5,2:4]='|'
write(z,'',9,,'')}
Example for input 2015 12 07 00 00 00:
*
| *
| |
| |
+++++++++
|
-+-
APL (Dyalog), 193 bytes
Prompts for input from STDIN and prints to STDOUT.
Uses box drawing characters and an actual lamp symbol!
⎕USING←'System'
→3×(c←+/i≥((⎕NEW Globalization.HebrewCalendar).(ToDateTime 7↑3 23 18,⍨GetYear)i←⎕NEW DateTime(6↑⍎∊⍞'⎕TS')).AddDays¨⍳9)∊⍳8
¯5↑'⍝'
'⍝'@(10-r+5≤r←⍳c)⊢9↑s←¯5↑'│'
9/⍪'││┴'
s
' ─┴─'
⎕USING←'System'
Use .NET
⍳8
first eight ɩntegers
(
…)∊
Boolean for whether the following is a member of that:
⍳9
first nine integers
(
…).AddDays¨
for each, add that many days to:
⎕NEW DateTime(
…)
a new DateTime .NET object with the value of:
⍞'⎕TS'
STDIN and expression for current Time Stamp
∊
ϵnlist (flatten)
⍎
execute (evaluate) that (gives six- or seven-element numeric list)
6↑
take the first six elements (Y M D h m s)
i←
store as i
(for input)
(⎕NEW Globalization.HebrewCalendar).(
…)
in a new HebrewCalendar object:
GetYear
get the (Hebrew) year of the input
3 23 18,⍨
append these (3 month, 23th day, 18th hour — one night before Hanukkah)
7↑
take the first seven elements, padding with 0s (minutes, seconds)
ToDateTime
convert that Hebrew point in time to normal DateTime object
i≥
Boolean whether the input is equal to or after each of those
+/
sum the Booleans
c←
store as c
(for count)
3×
multiply by three
→
go to that line (3, i.e. next, if Hanukkah; 0, i.e. quit, if not)
¯5↑'⍝'
implicitly print the last five characters of the lamp symbol (padding with spaces)
¯5↑'│'
last five characters of the middle-candle symbol (padding with spaces)
s←
store as s (for stem)
9↑
take the first nine characters from that (padding with spaces)
⊢
yield (separates the above from the below
'⍝'@(
…)
implicitly print with lamps placed at the following indices:
⍳c
as many ɩntegers as count of begun Hanukkah days
r←
store in r
(for range)
5≤
Booleans for those larger than or equal to five (to skip the middle candle)
r+
add to the range of indices
10-
subtract those from ten (to begin at the right)
⍪'││┴'
make this string into a column matrix
9/
implicitly print nine horizontal copies of that
s
implicitly print the stem
' ─┴─'
implicitly print this string
Example run:
menorah
2015 12 7 0 0 0
⍝
│ ⍝
│││││││││
│││││││││
┴┴┴┴┴┴┴┴┴
│
─┴─
menorah
2015 12 9 0 0 0
⍝
│ ⍝⍝⍝
│││││││││
│││││││││
┴┴┴┴┴┴┴┴┴
│
─┴─
menorah
2015 12 14 0 0 0
⍝
⍝⍝⍝⍝│⍝⍝⍝⍝
│││││││││
│││││││││
┴┴┴┴┴┴┴┴┴
│
─┴─
menorah
2015 12 15 0 0 0