This removes `Datelike::isoweekdate` in favor of `Datelike::iso_week`.
The original `isoweekdate` was not named in accordance with the style
guide and also used to return the day of the week which is already
provided by `Datelike::weekday`. The new design should be more
reasonable.
Note that we initially do not implement any public constructor for
`IsoWeek`. That is, the only legitimate way to get a new `IsoWeek` is
from `Datelike::iso_week`. This sidesteps the issue of boundary values
(for example the year number in the maximal date will overflow in
the week date) while giving the same power as the original API.
Partially accounts for #139. We may add additional week types
as necessary---this is the beginning.
Linkchecker recognizes the distinction between internal and external
links (which are not checked by default), and considers URLs which
does not have the starting URL base as a prefix internal...
This commit has been verified against a proper set of options to
Linkchecker, but there are several false positives (for our purposes)
which would make the automated checking not as effective. </rant>
There used to be multiple modules like `chrono::datetime` which only
provide a single type `DateTime`. In retrospect, this module structure
never reflected how people use those types; with the release of 0.3.0
`chrono::prelude` is a preferred way to glob-import types, and due to
reexports `chrono::DateTime` and likes are also common enough.
Therefore this commit removes those implementation modules and
flattens the module structure. Specifically:
Before After
---------------------------------- ----------------------------
chrono:📅:Date chrono::Date
chrono:📅:MIN chrono::MIN_DATE
chrono:📅:MAX chrono::MAX_DATE
chrono::datetime::DateTime chrono::DateTime
chrono::datetime::TsSeconds chrono::TsSeconds
chrono::datetime::serde::* chrono::serde::*
chrono::naive::time::NaiveTime chrono::naive::NaiveTime
chrono::naive:📅:NaiveDate chrono::naive::NaiveDate
chrono::naive:📅:MIN chrono::naive::MIN_DATE
chrono::naive:📅:MAX chrono::naive::MAX_DATE
chrono::naive::datetime::NaiveDateTime
chrono::naive::NaiveDateTime
chrono::naive::datetime::TsSeconds chrono::naive::TsSeconds
chrono::naive::datetime::serde::* chrono::naive::serde::*
chrono::offset::utc::UTC chrono::offset::UTC
chrono::offset::fixed::FixedOffset chrono::offset::FixedOffset
chrono::offset::local::Local chrono::offset::Local
chrono::format::parsed::Parsed chrono::format::Parsed
All internal documentation links have been updated (phew!) and
verified with LinkChecker [1]. Probably we can automate this check
in the future.
[1] https://wummel.github.io/linkchecker/Closes#161. Compared to the original proposal, `chrono::naive` is
retained as we had `TsSeconds` types duplicated for `NaiveDateTime`
and `DateTime` (legitimately).
- Formatting item types are no longer `Copy`.
- `Numeric` and `Fixed` items now have `Internal` variants reserved
for the future expansion. It had been hard to expand the items
without totally breaking the backward compatibility (as per
the API evolution guideline of RFC 1105).
- `Item::Owned{Literal,Space}` for the owned variant of
`Item::{Literal,Space}` has been added.
Closes#76.
This may sound strange, but the final type for the offset "value" was
originally `time::Duration` (returned by `Offset::local_minus_utc`).
This caused a lot of problems becaus adding `Duration` fully interacts
with leap seconds and `Duration` itself is somewhat deprecated.
This commit entirely replaces this role of `Duration` with
`FixedOffset`. So if we had `Offset` and `Duration` to represent
the "storage" offset type and the offset "value" in the past,
we now have `Offset` and `FixedOffset`. Storage-to-value conversion is
called to "fix" the offset---an apt term for the type.
The list of actual changes:
- The time zone offset is now restricted to UTC-23:59:59 through
UTC+23:59:59, and no subsecond value is allowed. As described above,
`FixedOffset` is now fully used for this purpose.
- One can now add and subtract `FixedOffset` to/from timelike values.
Replaces a temporary `chrono::offset::add_with_leapsecond` function.
Datelike & non-timelike values are never affected by the offset.
- UTC and local views to `Date<Tz>` are now identical. We keep
relevant methods for the consistency right now.
- `chrono::format::format` now receives `FixedOffset` in place of
`(Old)Duration`.
- `Offset` now has a `fix` method to resolve, or to "fix" the
"storage" offset (`Offset`) to the offset "value" (`FixedOffset`).
- `FixedOffset::{local_minus_utc, utc_minus_local}` methods are added.
They no longer depend on `Duration` as well.
Due to the backward compatibility we won't be going to remove support
for `time::Duration` in 0.3, and the initial 0.3.0 release won't have
proper `std::time::Duration` support (haven't finalized the logics).
However we will reserve proper names and signatures for the upcoming
`std::time::Duration` support---the "older" duration type will be
referred as "signed" in the names.
- Added a `chrono::prelude` module. This does not have the (old)
`Duration` type reexported, so the documentation has now correctly
replaced all occurrences of `chrono::Duration`. The existing
`chrono::Duration` reexport itself remains for the compatibility.
- Avoided using a plain `Duration` type in the signature, to avoid
any ambiguity.
- Renamed `checked_{add,sub}` to `checked_{add,sub}_signed`.
- Subtraction operator between two instants has been removed and
replaced with `signed_duration_since`. This follows the naming
chosen by `std::time::SystemTime` etc., and the version for newer
`std::time::Duration` will be named to `duration_since`.
While writing documentation tests for NaiveTime it was found that
the addition involving leap seconds is *still* slightly broken.
(A consequence of having less tests, well.) The addition routine
has been rewritten to be explicit about leap seconds while passing
all other tests, so the rewrite does not change the intention.
- Padding modifiers `%_?`, `%-?` and `%0?` are implemented.
They are glibc extensions which seem to be reasonably widespread
(e.g. Ruby).
- Added `%:z` specifier and corresponding formatting items
which is essentially same to `%z` but with a colon.
- Added a new specifier `%.f` which precision adapts from the input.
Also clearly documented the differences between `%f` and `%.f`. (#40)
- The time zone offset is printed without a colon, but the documentation
had that inverted. (#39)
- `chrono::format::strftime`'s specifier table is tested throughly.
- When `%s` specifier is used with a time zone, the time zone offset was
ignored. This has been fixed.
this is partly because... we are using the simple name `timestamp`
in the `Parsed` anyway. that value is so widespread enough that
its name can be simply THE timestamp. old methods have been marked
deprecated.
also, previously `Numeric::Nanosecond` had a special left-aligned
parsing behavior. this commit replaces that with a newly designated
`Fixed::Nanosecond` which also handles an empty string which is
possible with an integral number of seconds.
this new module encompasses John Nagle's original RFC 2822 and 3337
parsers, updated to fully compatible to the actual standard.
the contributed `parse` module has been merged into it.
also changes the behavior of `Numeric::Nanosecond` (`%f`) to
the left-aligned digits and allows for the wider range of time zone
offsets from -99:59 to +99:59.
- Format string is internally represented as a series of formatting
items. Items can be directly given to now-public `format::format`
function as well.
- Format string parser is separated to `format::strftime` module.
This is to allow for potentional alternative formatting syntaxes.
- `DelayedFormat` now receives an iterator for formatting items.