0

How do I pick a date to display a specific content for the web?

Hi guys! I'm developing a code that I want to put a birthday (22/11/1984) to presents a specific information. But it has some peculiarities such as: Chinese zodiac year match to animals. Unfortunately start and end dates are never on the same day as our ocidental calendar. For example: who borns on 25/01/1982 - 01/02/1984 is Pork, on 02/02/1984 - 19/02/1985 is Rat and on 20/02/1985 - 08/02/1986 is Ox. The birthday I will select on the HTML form is 22/11/1984 which is 19841122 animal year start end Rat 1984 02/02/1984 19/02/1985 Besides that I have a JavaScript and do you how do I make it works by saying 19841122 => start and =< end to present a specific text content? My HTML form: <input id="form-chinese" type="date"> Besides that I have a JavaScript: <script> /* global $ */ var dates = [ { start: "19830213", end: "19840201", id: "pork" }, { start: "19840202", end: "19850219", id: "rat" }, { start: "19850220", end: "19860208", id: "ox" }, ]; </script> Please help me to find out a solution.

5th Aug 2019, 4:13 PM
Alex Ribeiro
Alex Ribeiro - avatar
3 odpowiedzi
+ 2
Try to use standard date format input for Date class or use map method to set a property of start and end Such as {startDs: "1983-02-13", ...} And start and end dateString can be converted to timestamp values. You then can compare the the timestamp values with the selected date timestamp by checking the timestamp integer range using > or < operators.
6th Aug 2019, 1:30 AM
Calviղ
Calviղ - avatar
8th Aug 2019, 2:18 AM
Calviղ
Calviղ - avatar
0
Calvin, do you have some practical example about your suggestion? I got difficult on JavaScript subject.
7th Aug 2019, 3:05 PM
Alex Ribeiro
Alex Ribeiro - avatar