Dateããããã¿ã¤ãæ±æããå®ãExDate
ã¨ããJavaScriptã®ã©ã¤ãã©ãªãä½ãã¾ããã
GitHub - monjudoh/ExDate: JavaScript Date class wrapper for using conbination with Date libraly which leads to prototype pollution.
ä½ãããã©ã¤ãã©ãªã
ExDateã¨ããclassãå®ç¾©ãã¦ãã¾ãã
ãã£ã¦ãããã¨ã¯ãã¤ã³ã¹ã¿ã³ã¹ãä½æããã¨åãã³ã³ã¹ãã©ã¯ã¿å¼æ°ã§Date objectãä½æãã
å
é¨ã«æ±ãã¦ãDate objectã®ã¡ã½ãããå¼ã°ããã¨å¦çã丸æãããã ãã§ãã
ä½ãå¬ããã®ã
Datejs(GitHub - datejs/Datejs: A JavaScript Date and Time Library)ã¨ãã大å¤ä½¿ãåæã®ããã©ã¤ãã©ãªãããã®ã§ããã
Date,Date.prototypeãèªéãªãæ±æãã¦ãã¦ã使ç¨ããããããã¾ãã
ä½ãã¾ãããã¨ããã¨ä»å¾JavaScriptæ¨æºã®Dateã«ã¡ã½ãããå¢ãã¦ãã¦ãã
é¢ä¿ãªãä¸æ¸ããã¦ãã¾ãæ£ããåä½ããªããªã£ã¦ãã¾ãã¾ããã
å®éECMAScript5ã®Date.nowã¡ã½ããã¯ä¸æ¸ãããã¦ãã¾ã£ã¦ãã¾ããã
ãããã¿ã¤ãå¤æ´ã®å¯¾è±¡ãDateããExDateã«ããã°å®å
¨ã«ä½¿ç¨ã§ãã¾ãã
使ãæ¹
- ExDateãèªã¿è¾¼ã
- Dateãããã¯ã¢ããããä¸ã§ãExDateã¨å·®ãæ¿ãã
- originalDate=Date;Date=ExDate;
- Date,Date.prototypeãæ±æããã©ã¤ãã©ãªãèªã¿è¾¼ã
- ããã¯ã¢ããããå
ã®Dateãæ»ã
- Date=originalDate;
ãããããã°ãExDateã§å種ã©ã¤ãã©ãªã«ããDateæ¡å¼µã®æ©è½ã使ããããã«ãªãã¾ãã
Datejsã¨çµã¿åãããå ´åã®ãã¢ãGithubã«ä¸ãã¦ããã®ã§ã
cloneãã¦è©¦ãã¦ã¿ã¦ãã ããã