Changeset 38657 in project


Ignore:
Timestamp:
04/27/20 15:36:20 (5 weeks ago)
Author:
Kon Lovett
Message:

momentjs date adjust semantic difference not a bug or limitation, remove inexact arithmetic note about conversion loss, fix (or add) labels to read-date-literal, add which format is used for write-date-literal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/5/srfi-19

    r38656 r38657  
    553553<procedure>(read-date-literal [PORT]) -> list</procedure>
    554554
    555 Read a {{date}} from the {{PORT}} in one of the support ISO forms, and returns
    556 the creation source form.
     555Read a date-literal from the {{PORT}}, in one of the supported forms, and return
     556the object creation source form; {{'(make-date ....)}}.
    557557
    558558; {{PORT}} : {{input-port}} ; default {{(current-input-port)}}
    559559
     560Supported forms:
    560561; {{"~Y-~m-~dT~H:~M:~S~z"}} : date time timezone
    561 ; {{"~Y-~m-~dT~H:~M:~S"}} :  date time
    562 ; {{"~Y-~m-~d"}} :  date
     562; {{"~Y-~m-~dT~H:~M:~S"}} : date time
     563; {{"~Y-~m-~d"}} : date
    563564; {{"~H:~M:~S~z"}} : time timezone; {{date}} components from {{(current-date)}}
    564565; {{"~H:~M:~S"}} : time; {{date}} components from {{(current-date)}}
     
    568569<procedure>(write-date-literal DATE [PORT])</procedure>
    569570
    570 Write the {{DATE}} to the {{PORT}} using a string ISO form.
     571Write the {{DATE}} to the {{PORT}} using a string ISO form; {{"~Y-~m-~dT~H:~M:~S~z"}}.
    571572
    572573; {{PORT}} : {{output-port}} ; default {{(current-output-port)}}
     
    807808* A SRFI-18 time object is not accepted except by the conversion procedures.
    808809
    809 * The expression {{(time=? (seconds->time (nanoseconds->seconds
    810 (time->nanoseconds <time-duration>))) <time-duration>)}} might be {{#f}}, due
    811 to the use of inexact arithmetic.
    812 
    813810* The English (en) SRFI 29 bundle is American.
     811
     812* Using {{date-adjust}} for the same {{date-key}} MomentJS says:
     813
     814If you are adding hours, minutes, seconds, or milliseconds, the assumption is
     815that you want precision to the hour, and will result in a different hour.
     816
     817<enscript language=javascript>
     818var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
     819m.hours(); // 5
     820m.add(24, 'hours').hours(); // 6
     821</enscript>
     822
     823but this implementation says 1 day = 24 hours, so same hour.
    814824
    815825
     
    827837
    828838* Cannot swap SRFI 29 bundle. Fixed at load time.
    829 
    830 * Using {{date-adjust}} for the same {{date-key}} MomentJS says:
    831 
    832 If you are adding hours, minutes, seconds, or milliseconds, the assumption is
    833 that you want precision to the hour, and will result in a different hour.
    834 
    835 <enscript language=javascript>
    836 var m = moment(new Date(2011, 2, 12, 5, 0, 0)); // the day before DST in the US
    837 m.hours(); // 5
    838 m.add(24, 'hours').hours(); // 6
    839 </enscript>
    840 
    841 but this implementation says 1 day = 24 hours, so same hour.
    842839
    843840
Note: See TracChangeset for help on using the changeset viewer.