Giter Club home page Giter Club logo

pollyjean.github.io's Introduction

Hello.

Hello from myself.

pollyjean.github.io's People

Contributors

pollyjean avatar

Watchers

 avatar

pollyjean.github.io's Issues

"holiday: 'left until' text is always displayed, even when the D-Day is negative"

크리스마스가 지난경우에는 dday가 음수로 표시됩니다.

holiday

수리물리적으론 문제가없는거같지만,
아직도 상대론을 잘 모르는 클라이언트를 배려하기위해
수정을 해준다면 센스가 돋보일것 같습니다.

개선방안 A:문구 변경

  1. 우선 Math.abs를 이용하여 days의 마이너스 부호를 없애줍니다.
const days = Math.abs(Math.floor(dDay / (24 * 60 * 60 * 1000)));
  1. "left until" 텍스트 부분을 변수로 바꾸고, 조건부로 저장 값이 바뀌게 설정합니다.
const timeStatus = dDay.getTime() > 0 ? "left until" : "passed after";
clockTitle.innerText = `${days}d ${hours}h ${minutes}m ${timeStatus} Holiday.`;

"passed after"보다는 "have passed since the Holiday"가 더 적절한 영어 표현이지만,
간결한 표기를 지키기위해 전자를 선택했습니다.

저희는 programmer's brain의 reader로서의 품위를 지킵시다.

개선 방안 B: 크리스마스 날짜 변경

"left until"은 그대로 두고, xmas의 날짜를 항상 다가오는 크리스마스로 수정합니다.

const yearUpcomingXmas = (now.getMonth() === 11 && now.getDate() >= 25) ? now.getFullYear() + 1 : now.getFullYear();
const xmas = new Date(`${yearUpcomingXmas}/12/25 00:00:00`);

holliday2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.