51
1
The day this post was published was Christmas Eve. Tomorrow will be Christmas. Yesterday was Christmas Eve Eve. In two days it will be
Christmas Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve Eve
.
Your job is to take the date the program is run and encode it in Christmas Eve format.
- If your program is run on Christmas, it should output the string "Christmas".
- If your program is not run on Christmas, it should output the string "Christmas", followed by the string " Eve" repeated
n
times, wheren
is the number of days until Christmas.- Note that this must be based on the next Christmas. For example, if the day is April 26, 2019, you must do your calculation based on December 25, 2019, not any other Christmas.
- Remember to count leap days.
- Christmas is December 25th of every year.
This is code-golf, so the shortest code wins! Note though that the goal is not to find the shortest program in any language, but to find the shortest program in every particular language. For example, if you find the shortest C++ program, then it wins this contest for C++, even if someone finds a shorter program in Python.
7Somehow I knew that this was going to be a PPCG challenge the moment I saw the cartoon - +1 from me – Black Owl Kai – 2018-12-24T23:36:07.603
@BlackOwlKai what cartoon? – PyRulez – 2018-12-24T23:37:09.923
25
A xkcd cartoon that was published today. https://imgs.xkcd.com/comics/christmas_eve_eve.png
– Black Owl Kai – 2018-12-24T23:38:27.9237@BlackOwlKai LMBO I didn't even see that comic until your comment. I had already planned to post this, and was just waiting for Christmas Eve. Great minds think alike, I guess? – PyRulez – 2018-12-24T23:41:56.543
You should specify that you mean Dec 25 for "Christmas", unless you want submissions that use a local date or calendar. – Sparr – 2018-12-25T00:51:13.790
@Sparr fixed it – PyRulez – 2018-12-25T02:29:14.913
@tsh a quick search suggests that is true in all time zones. Since dates are complicated as it is, you may assume anything that is always true (i.e. you do not need to worry about hypotheticals). – PyRulez – 2018-12-25T02:44:07.310
So, is the program supposed to encode a given date, or produce output based on the date it's run? – Sean – 2018-12-25T02:58:25.740
@Sean oh, it produces output based on the day it runs. I'll fix the post. – PyRulez – 2018-12-25T02:59:46.810
Does case matter? Can we output all uppercase or all lowercase? – Shaggy – 2018-12-25T08:39:36.977
@Shaggy uhm, we'll say case matters, since the post didn't say otherwise. Too late to change it now. – PyRulez – 2018-12-25T13:53:38.280
What about the second holiday? It´s still Christmas on Decmber 26, isn´t it? – Titus – 2018-12-25T16:05:31.560
@Titus yes, but it is also Christmas Eve*364. – PyRulez – 2018-12-25T16:06:39.543
1Can the date be a parameter? – Olivier Grégoire – 2018-12-26T11:23:32.010
1@OlivierGrégoire uhm, I'll permit it iff the language does not have the ability to get the current date in another way. – PyRulez – 2018-12-26T14:53:42.453
1This may be nitpicking, but 25 December is not Christmas (there are, famously, twelve days to the holiday – or more, or fewer, depending on locality), but Christmas Day. It would make more sense to output Christmas Eve(ⁿ) for other days and then Christmas Day on 25 December. – Janus Bahs Jacquet – 2018-12-27T11:38:41.317
1@JanusBahsJacquet okay, I'll edit the question and flag all the current answers as being outdated. On a serious note, I'll keep that in mind in the future, but it's kinda hard to fix now. – PyRulez – 2018-12-27T20:26:07.523
We can ignore leap seconds, right? – ASCII-only – 2018-12-28T00:38:38.813
@ASCII-only I already told someone else not to, so probably not. – PyRulez – 2018-12-28T04:42:48.723
https://xkcd.com/2089/ – MilkyWay90 – 2019-01-03T17:00:19.047