43 Commits

Author SHA1 Message Date
Dirkjan Ochtman
7cd5e03ee4 Fix up internal calls to newly deprecated methods 2022-10-09 14:15:02 +02:00
Eric Sheppard
3421cbdeeb extra imports due to powerset features check 2022-09-26 12:47:29 +02:00
René Kijewski
16b2ae4156 Add feature documentation for docs.rs
This way the documentation will thell user which feature(s) are needed
to use a function, trait, etc. docs.rs display the information like

> Available on crate feature `serde` only.
2022-08-22 20:26:38 +02:00
Jarosław Konik
5f5410163b
GNU coreutils date-like time zone formatting (#759)
Co-authored-by: Eric Sheppard <key2@eric.sheppard.cloud>
2022-08-17 18:41:48 +02:00
Mohammad AlSaleh
8275b13941
strftime: Improve "%+" documentation (#769) 2022-08-14 13:56:27 +02:00
Dirkjan Ochtman
95223ee267 format: be specific about support year range 2022-08-10 07:16:49 +02:00
Alex Gaynor
5edf4d0cc7
fixes #758 -- correctly document that %Y parses negative years (#760) 2022-08-09 22:15:17 +10:00
Dirkjan Ochtman
2368e37f8e Adopt modern clippy suggestions 2022-03-21 22:20:27 -07:00
Dirkjan Ochtman
e4c8a529f5 Update to 2018 edition (and MSRV 1.32) 2022-03-19 20:38:12 -07:00
Dirkjan Ochtman
216c18f62a Clean up clippy warnings 2022-02-28 18:05:35 +01:00
Aleksandr Bashurov
f4c42b4f14
Skip IANA TZ names when parsing %Z specifier (#473) 2020-08-21 11:56:10 -04:00
Cecile Tonglet
8d6d83f7b8
Locales and format_localized (#453) 2020-07-31 10:05:40 -04:00
Brandon W Maister
febb8dc168 rustfmt everything 2020-06-27 17:04:22 -04:00
Waldir Pimenta
176dfeff87 Reword 'same to' --> 'same as' 2019-12-29 22:27:59 +00:00
Brandon W Maister
6a2adc45b7 Use markdown footnotes in strftime docs 2019-11-22 11:30:10 -05:00
Brandon W Maister
df4912a33f Test formatting with more precise nanoseconds
There is some specific behavior around writing out truncated nanos that we want
to be sure to preserve.
2018-06-13 23:00:31 -04:00
Evan Schwartz
11cfb3696e Move NanosecondXNoDot to internal enum
To avoid adding new variants to the public enum (see https://github.com/chronotope/chrono/pull/251#issuecomment-396692148)
2018-06-12 14:53:49 -04:00
Evan Schwartz
074e92fc63 Document millisecond format without the dot 2018-06-12 10:51:36 -04:00
Evan Schwartz
1de3658433 Add nanoseconds without dots 2018-06-12 10:51:07 -04:00
Brandon W Maister
c3207a5811 Use the InternalFixed struct for TimezoneOffsetPermissive
It is the backcompat scheme that we have. In the 5.x timeline we will add the
more-standard and significantly-more-pleasant-to-expand `#[doc(hidden)]
__DoNotMatchAgainstMe` trick.
2018-06-07 21:46:57 -04:00
Brandon W Maister
9991c2b0ed Rust 1.13 does not support elided lifetimes in const. 2018-06-07 21:46:57 -04:00
Brandon W Maister
95f6a2be1c Add %#z as "Permissive" timezone parsing
This allows you to parse a timezone that:

* Is either `Z` or an actual offset
* Contains no minutes, just the hour

Fixes #219
2018-06-07 21:46:57 -04:00
kennytm
8a6a99018a
Fix a markdown rendering difference warning.
Rust is going to change its Markdown rendering engine from hoedown to
pulldown-cmark. In pulldown, a table row starting with just whitespaces
will cause that whole cell disappeared. This causes rendering difference
between the two engines.

To fix this, we add leading and trailing `|` to the rows so that empty
cells are correctly rendered.
2018-01-22 02:34:15 +08:00
Brandon W Maister
5bb493976b Add a note and example to DateTime::parse_from_str
The note points out that `NaiveDateTime::parse_from_str` is required if you
don't know the offset, and the example demonstrates that.

Closes #183
2017-10-09 21:23:22 -04:00
Brandon W Maister
ce6ea4d8d1 deny(missing_debug_implementations) 2017-07-09 15:23:07 -05:00
Brandon W Maister
330504792b Fix Clippy lints: match_same_arms 2017-07-09 15:10:26 -05:00
Brandon W Maister
4a70e160fb Fix Clippy lints: or_fun_call 2017-07-09 15:10:26 -05:00
Brandon W Maister
fac6ff44c9 Fix Clippy lints: needless_return 2017-06-24 13:12:33 -05:00
Kang Seonghoon
0ac41c70b1
Minor additions to formatting items.
- 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.
2017-02-07 04:05:05 +09:00
Kang Seonghoon
de4df91421
Removed all remaining mentions of rust-chrono (very old name). 2017-02-06 06:15:57 +09:00
Kang Seonghoon
66d5856354 Fixed %.[369]f on the whole seconds and misleading docs.
Fixes #71.
2016-04-22 00:47:01 +09:00
Tom Gallacher
c44de1d388 Updating docs 2015-09-03 13:53:18 +01:00
Tom Gallacher
7b31609418 Adding fixed precision for Nanosecond3, 6 and 9 2015-09-03 13:40:34 +01:00
Kang Seonghoon
1f40b03ab9 new formatting specifiers to strftime syntax.
- 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)
2015-07-05 15:00:11 +09:00
Kang Seonghoon
0466a4bf30 documentation fix and some slight bug fix.
- 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.
2015-05-29 02:26:01 +09:00
Kang Seonghoon
0d6c3ce11a a couple of documentation fixes.
- We've got 1.0.0, so no need for version pinning now.

- `%Z` is formatting-only specifier but wasn't clearly documented.
  Fixes #38.
2015-05-25 10:12:11 +09:00
Kang Seonghoon
9ed34ec542 0.2.9: language changes.
- `std::num::Int` is deprecated.

- Removed one feature flag (`str_char`).
2015-04-03 17:53:44 +09:00
Kang Seonghoon
e012702033 0.2.8: language changes.
- Slice patterns are now feature gated.

- Reformatted the `chrono::format::strftime` documentation
  with a proper table (closes #31).
2015-03-30 10:23:20 +09:00
Dan
d85ca7564f Remove old closure kind syntax 2015-03-02 11:50:03 +00:00
Kang Seonghoon
ca865e3c24 added more tests for non-four-digit years and fixed edge cases. 2015-02-18 00:00:30 +09:00
Kang Seonghoon
637784c8ef renamed from_str methods to parse_from_str.
so that we can safely implement `FromStr` traits for those types.
also updates READMEs and rewires `%+` specifier of `StrftimeItems`
to a new RFC 3339 formatting item.
2015-02-15 21:27:12 +09:00
Kang Seonghoon
82c63e5b40 0.2.0-dev: date/time parsing.
Basically, this should close #12 when officially released.

- Formatting syntax is now refactored out of the rendering logic.
  The main syntax is available in the `format::strftime` module,
  which also serves as a documentation for the syntax.

- A parser (modelled after `strptime(3)`) has been implemented.
  See the individual commits for the detailed implementation.

- There are two ways to get a timezone-aware value from a string:
  `Offset` or `DateTime<FixedOffset>`. The former should be used
  when the offset is known in advance (e.g. assume the local date)
  while the latter should be used when the offset is unknown.
  Naive types have a simple `from_str` method.

- There are some known problems with the parser (even after
  tons of tests), which will be sorted out in 0.2. Known issues:

  - This does not exactly handle RFC 2822 and RFC 3339, which
    subtly differs from the current implementation in
    case-sensitivity, whitespace handling and legacy syntax.
    I'd like to integrate #24 for this cause.

  - Time zone names are not recognized at all. There is even
    no means to get a name itself, not sure about the resolution.

  - `Parsed` does *not* constrain `year` to be non-negative,
    so manually prepared `Parsed` may give a negative year.
    But the current verification pass may break such cases.

  - I absolutely don't know about the parser's performance!

- `AUTHORS.txt` has been added, for what it's worth.
2015-02-05 02:53:19 +09:00
Kang Seonghoon
43ee68b522 new formatter design!
- 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.
2015-02-04 16:19:54 +09:00