wenyan-lang/wenyan

吾嘗觀『曆法』之書 (Date library implementation proposal)

Open

#425 aperta il 29 dic 2019

Vedi su GitHub
 (6 commenti) (4 reazioni) (0 assegnatari)TypeScript (1096 fork)batch import
help wantedstdlib

Metriche repository

Star
 (19.271 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

I have an idea on the implementation of date library:

Wenyan JS equivalent
吾有一時。名之曰「今」。 var 今 = new Date();
吾有一時。曰二千八年八月八日八時八分八秒。名之曰「昔」。 var 昔 = new Date(2008, 8 - 1, 8, 8, 8, 8);
夫「今」之年。 今.getFullYear();
夫「今」之月。 今.getMonth() + 1;
夫「今」之日。 今.getDate();
夫「今」之時。 今.getHours();
夫「今」之分。 今.getMinutes();
夫「今」之秒。 今.getSeconds();
夫「今」之毫秒。 今.getMilliseconds();
夫「今」之曜。 今.getDay();
昔之「昔」之年者。今二千十八是矣。 昔.setFullYear(2018);
昔之「昔」之月者。今十二是矣。 昔.setMonth(12 - 1);

TODO add functions for date-time calculations (no JS equivalents yet)

Guida contributor