diff --git a/README.md b/README.md index eb0d4f2..1967af0 100644 --- a/README.md +++ b/README.md @@ -590,7 +590,7 @@ Datetime ```python from datetime import date, time, datetime, timedelta -from dateutil.tz import UTC, tzlocal, gettz +from dateutil.tz import UTC, tzlocal, gettz, resolve_imaginary ``` ### Constructors @@ -603,6 +603,7 @@ from dateutil.tz import UTC, tzlocal, gettz ``` * **Use `'.weekday()'` to get the day of the week (Mon == 0).** * **`'fold=1'` means second pass in case of time jumping back for one hour.** +* **`'
= resolve_imaginary(
)'` fixes DTs that fall into missing hour.** ### Now ```python @@ -652,12 +653,11 @@ from dateutil.tz import UTC, tzlocal, gettz "Thursday, 14th of May '15, 11:39PM UTC+02:00" ``` * **When parsing, `'%z'` also accepts `'±HH:MM'`.** -* **For abbreviated weekday and month use `'%a'` and `'%b'`.** ### Arithmetics ```python - = - - = ± + = - # Returns the difference between wall times. + = ± # Result can be an imaginary time. = ± = * ``` diff --git a/index.html b/index.html index d6580fa..1e79e96 100644 --- a/index.html +++ b/index.html @@ -644,7 +644,7 @@ shuffle(<list>)
  • Time and datetime can be 'aware' <a>, meaning they have defined timezone, or 'naive' <n>, meaning they don't.
  • If object is naive it is presumed to be in the system's timezone.
  • from datetime import date, time, datetime, timedelta
    -from dateutil.tz import UTC, tzlocal, gettz
    +from dateutil.tz import UTC, tzlocal, gettz, resolve_imaginary
     
    @@ -658,6 +658,7 @@ shuffle(<list>)
    • Use '<D/DT>.weekday()' to get the day of the week (Mon == 0).
    • 'fold=1' means second pass in case of time jumping back for one hour.
    • +
    • '<DT> = resolve_imaginary(<DT>)' fixes DTs that fall into missing hour.

    Now

    <D/DTn>  = D/DT.today()                     # Current local date or naive datetime.
     <DTn>    = DT.utcnow()                      # Naive datetime from current UTC time.
    @@ -701,10 +702,9 @@ shuffle(<list>)
     
     
    • When parsing, '%z' also accepts '±HH:MM'.
    • -
    • For abbreviated weekday and month use '%a' and '%b'.
    -

    Arithmetics

    <TD>     = <D/DT> - <D/DT>
    -<D/DT>   = <D/DT> ± <TD>
    +

    Arithmetics

    <TD>     = <D/DT> - <D/DT>                  # Returns the difference between wall times.
    +<D/DT>   = <D/DT> ± <TD>                    # Result can be an imaginary time.
     <TD>     = <TD>   ± <TD>
     <TD>     = <TD>   * <real>
     
    diff --git a/parse.js b/parse.js index 47f7954..ee32e3d 100755 --- a/parse.js +++ b/parse.js @@ -63,6 +63,9 @@ const DATACLASS = '<class> = make_dataclass(\'<class_name>\', <coll_of_tuples>)\n' + '<tuple> = (\'<attr_name>\', <type> [, <default_value>])
    '; +const DATETIME = + '\'<DT> = resolve_imaginary(<DT>)\''; + function main() { const html = getMd(); @@ -156,6 +159,7 @@ function fixHighlights() { $(`code:contains(@lru_cache(maxsize=None))`).html(LRU_CACHE); $(`code:contains(\'\', , )`).html(TYPE); $(`code:contains(make_dataclass(\'\')`).html(DATACLASS); + $(`code:contains((
    ))`).html(DATETIME) } function preventPageBreaks() {