JSFiddle - React, Tailwind, and code Playground

HTML

會做這個是因為,遇到 Safari in MAC , type=date 竟然沒有漂漂釀釀的日期選擇器

JavaScript

if(window.navigator.userAgent.match(/^((?!chrome|android).)*safari/i)){
	if (window.navigator.userAgent.match(/iPad/i) || window.navigator.userAgent.match(/iPhone/i)) {
               //Because iPhone and iPad can use type=date
               //input type can use date 
               alert('你是iPhone or iPad 的Safari , 所以你可以使用 type=date');
            }else{
             
            	//use datetimepicker 
               alert('你是電腦版的safari 所以得用其他的datepicker 來處理');
            }
}
else{
	//Because all browser can support type=date
	//input type can use date 
  alert('因為你不是天殺的safari on mac 所以可以使用 type=date');
}