fuzzy-datetime 0.1.2

Detects, completes and normalises fuzzy date and date-time strings for interoperability with chrono or direct output as ISO-8601-compatible strings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use simple_string_patterns::CharGroupMatch;

/// check if athe captured last segment represents milliseconds, microseconds or nanoseconds with an optional character at at the end
pub(crate) fn segment_is_subseconds(segment: &str) -> bool {
    let s_len = segment.len();
    if s_len >= 3 {
      if s_len > 3 {
        let last = &segment[s_len - 1..];
        let head = &segment[..s_len - 1];
        head.is_digits_only() && last.has_alphanumeric()
      } else {
        segment.is_digits_only()
      }
    } else {
      false
    }
  }