๋…ธ์…˜ D-day ๋งŒ๋“ค๊ธฐ

๋…ธ์…˜ D-day ๋งŒ๋“ค๊ธฐ

๐Ÿ“Œ TL;DR

๐Ÿ’ก

๋…ธ์…˜ ์ธ๋ผ์ธ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ์„œ์‹์„ ํ™œ์šฉํ•˜๋ฉด ์ž๋™์œผ๋กœ D-day ๊ณ„์‚ฐ์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.

๐Ÿ—“๏ธ

๋…ธ์…˜ D-day ๋งŒ๋“ค๊ธฐ

  • 1.

    ์›ํ•˜๋Š” ์˜์—ญ์—์„œ "/์ธ๋ผ์ธ"์„ ์ž…๋ ฅํ•œ ํ›„ "๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค - ์ธ๋ผ์ธ"์„ ์„ ํƒํ•œ๋‹ค.

  • 2.

    ๊ธฐ๋ณธ์ ์œผ๋กœ ์ƒ์„ฑ๋˜๋Š” "ํƒœ๊ทธ" ์†์„ฑ์€ ๋งˆ์šฐ์Šค ์šฐ์ธก ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ "์†์„ฑ ์‚ญ์ œ"๋ฅผ ๋ˆŒ๋Ÿฌ ์ œ๊ฑฐํ•œ๋‹ค.

  • 3.

    "+" ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ "๋‚ ์งœ" ์œ ํ˜•์˜ ์†์„ฑ์„ ์ƒ์„ฑ,

    ์†์„ฑ ์ด๋ฆ„์€ ๊ธฐ๋ณธ๊ฐ’์ธ "๋‚ ์งœ"๋กœ ์„ค์ •ํ•œ๋‹ค.

  • 4.

    ์ถ”๊ฐ€๋กœ "+" ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ "์ˆ˜์‹" ์œ ํ˜•์˜ ์†์„ฑ์„ ์ƒ์„ฑ,

    ์†์„ฑ ์ด๋ฆ„์€ "D-day"๋กœ ์„ค์ •ํ•œ๋‹ค.

  • 5.

    ์ƒ์„ฑ๋œ "D-day" ์†์„ฑ์—์„œ ๋น„์–ด์žˆ๋Š” ๊ฐ’์„ ํด๋ฆญํ•œ ํ›„,

    ์•„๋ž˜์—์„œ ์›ํ•˜๋Š” ์„œ์‹์„ ์ฐพ์•„ ์ž…๋ ฅํ•œ๋‹ค.

    1. ๋‚จ์€ ์ผ์ •๋งŒ ํ‘œ๊ธฐ

    if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") >= 0, 
                  if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") == 0, 
                     "๐ŸŽฏ D-day", 
                     ("-" + format(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days"))) + "์ผ"
                  ), 
                  ""
               )

    2. ์ง€๋‚˜๊ฐ„ ์ผ์ • ๋ชจ๋‘ ๋™์ผํ•˜๊ฒŒ ํ‘œ๊ธฐ

    if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") > 0, 
                  ("-" + format(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days"))) + "์ผ",
                  if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") == 0, 
                     "๐ŸŽฏ D-day", 
                     "๐Ÿ‘‹"
                  )
               )

    3. ๋ชจ๋“  ์ผ์ • ํ‘œ๊ธฐ

    if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") == 0, 
                  "๐ŸŽฏ D-day", 
                  if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") < 0, 
                      ("+" + format(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") * -1)), 
                      ("-" + format(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days")))
                  )
              )
              +
              if(dateBetween(prop("๋‚ ์งœ"), dateSubtract(dateSubtract(now(), hour(now()), "hours"), minute(now()), "minutes"), "days") == 0, 
                  "", 
                  "์ผ"
              )