2019骞�12鏈堢殑绗竴涓猙ug

鐜板湪鏄�2019骞�12鏈�1鏃�0鐐�27鍒嗭紝鎴戠殑蹇冩儏渚濇棫闅句互骞抽潤銆傝繖涓湀鏄�2019骞寸殑鏈�鍚庝竴涓湀锛屾槸21涓栫邯10骞翠唬鐨勬渶鍚庝竴涓湀锛屼篃鏄涓�鎵�90鍚�30宀佷互鍓嶇殑鏈�鍚庝竴涓湀銆傚氨鏄湪杩欎釜鏈堢殑绗竴澶╃殑0鐐�0鍒嗭紝鎴戝啓鐨勪唬鐮佸嚭浜嗕竴涓猙ug锛岀畝鐩磋鎴戞鍝棤娉��

浜嬫儏鏄繖鏍风殑锛屾垜浠叕鍙稿湪鍙屽崄涓�鎼炰簡涓績閿�娲诲姩锛屾椂闂存槸11鏈�1鏃ュ埌12鏈�1鏃�0鐐规暣銆備负浜嗕繚璇佸湪2019-12-01 0鐐规椂锛屾墍鏈夊皬绋嬪簭涓婂弻鍗佷竴鐩稿叧鐨刄I鍏冪礌鍑嗘椂涓嬫灦锛屾垜鍐欎笅浜嗗涓嬩唬鐮侊細

// 鏌ュ嚭12鏈�1鏃ョ殑鏃堕棿鎴�
new Date('2019-12-01').getTime() //鎴朌ate.parse('2019-12-01') 1575158400000
const isS11 = Date.now() < 1575158400000

涓�鍒囩殑UI鍏冪礌閮藉皢鏍规嵁杩欎釜isS11杩欎釜甯冨皵鍊艰繘琛屾樉绀哄拰闅愯棌銆傛垜鎻愬墠鎶婇�昏緫鍐欏ソ涔嬪悗锛屾棭鏃╁氨鍙戝竷鍒扮嚎涓娿�傚懆浜旇繍钀ョ殑鍚屼簨闂捣鏃惰繕寰楀埌鎴戜俊瑾撴棪鏃︾殑淇濊瘉锛屾垜璇达紝鑲畾娌¢棶棰橈紝鎴戦兘瀹夋帓濂戒簡锛�0鐐逛繚璇佷笅鏋躲��

0鐐圭殑閽熷0鏁插搷浜嗐�傝�佹澘鍦ㄧ兢閲屽彂浜嗙孩鍖咃紝鎴戞姠杩囦簡涔嬪悗锛屾墦寮�灏忕▼搴忥紝鐪嬬湅鍙屽崄涓�鏄笉鏄笅绾夸簡銆傛剰澶栬繕鏄嚭涔庢剰鏂欑殑鍙戠敓浜嗭紝鍏冪礌杩樺湪锛侊紒鎴戞湁鐐规厡浜嗚捣鏉ワ紝鍙堝皾璇曚簡鍒锋柊鍜岄噸鏂版墦寮�灏忕▼搴忥紝鍙屽崄涓�渚濈劧杩樺湪锛岀汗涓濅笉鍔ㄣ�傛垜灏辫寰楄劯鏈夌偣鐏荆杈g殑鈥斺�旀墦鑴镐簡锛�

鎴戦┈涓婃墦寮�vscode锛屾煡鎵惧師鍥狅紝鍦ㄦ帶鍒跺彴鍐欎笅涓嬮潰鐨勪唬鐮侊細

uploading-image-182689.png

绾冲凹锛熶负浠�涔堟槸鏃╀笂8鐐癸紵锛燂紵涓嶅簲璇ユ槸榛樿0鐐瑰悧锛熶笉绠′簡锛屽厛鏀规鍐嶈锛屼簬鏄姞涓婃椂鍒嗙锛�

const isS11 = Date.now() < Date.parse('2019-12-01 00:00')

杩欏洖姝e父浜嗐�傝刀绱х揣鎬ユ彁浜や竴涓増鏈厛锝炴彁浜ゅ畬涔嬪悗寮�濮嬬炕TC39鐨勮鑼冿細缁堜簬鍦ㄨ繖閲屾壘鍒颁簡瑙i噴銆傚綋Date鏋勯�犲嚱鏁版帴鍙椾竴涓瓧绗︿覆浣滀负鍙傛暟鏃讹紝浼氳皟鐢―ate.parse鏉ュ緱鍒版椂闂存埑銆傝�屽湪Date.parse涓湁杩欎箞涓�娈佃瘽锛�

When the UTC offset representation is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time.

缈昏瘧杩囨潵灏辨槸锛氬綋瀛楃涓蹭腑娌℃湁UTC鐨勬爣璁版椂锛屽彧鏈夋棩鏈熺殑瀛楃涓蹭細琚綋鎴怳TC鏃堕棿鏉ヨВ鏋愶紝鏈夋棩鏈熷拰鏃堕棿鐨勫瓧绗︿覆浼氳褰撴垚鏈湴鏃堕棿鏉ヨВ鏋愩��

new Date('2019-12-01') //鎸塙TC0鏃跺尯鐨勬椂闂�0鐐癸紝鐩稿綋浜庡寳浜椂闂存棭涓�8鐐�
new Date('2019-12-01 00:00') //鎸夊寳浜椂闂�0鐐�

鎴戜滑鏄笢鍏尯锛屾瘮UTC鏃堕棿蹇�8涓皬鏃躲�傛垜杈撳叆鐨勫瓧绗︿覆鏄�2019-12-01琚綋鎴怳TC鏃堕棿鐨�12鏈�1鏃�0鐐癸紝鎵�浠ユ崲鎴愭湰鍦版椂闂存槸12鏈�1鏃�8鐐广�傘�傘��

鏈�鍚庯紝棣栧厛鍚愭Ы涓�涓婽C39鍒跺畾瑙勮寖鐨勫ぇ浣滑锛屼负浠�涔堜笉鑳介兘鎸夋湰鍦版椂闂存潵瑙f瀽鍛紵涓嶇劧鎴戜篃涓嶄細鎺夊埌鍧戦噷銆傘�備笉杩囷紝濂藉湪寰俊鍔犳�ュ鏍告晥鐜囬珮锛屽彧鐢ㄥ崐涓皬鏃跺氨瀹℃牳閫氳繃锛堣繖閲岀粰寰俊鐐逛釜璧烉煈嶏級锛屾墠娌″紕涓櫄鑺備笉淇濔煒紙瀹岋級

你可能感兴趣的:(2019骞�12鏈堢殑绗竴涓猙ug)