Whitespaces inside the quotation changes the behavior of `TZ="TIMEZONE"`
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 45/100
Línea de trabajo
Comienza en src/items/timezone.rs y revisa el parser existente de TZ="..." y sus pruebas actuales. Comprueba los casos de espacios en blanco descritos en el issue y, después, verifica que el parser acepte el comportamiento propuesto para los espacios en blanco internos sin cambiar otras formas de zona horaria no relacionadas; se considera terminado cuando las pruebas relevantes pasan con los offsets previstos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This was a minor comment on https://github.com/uutils/parse_datetime/pull/232#issuecomment-3421283917 and it was suggested to create a separate issue for it
The following is the original copied here:
Hello, thanks to everybody for the great work.
I was studying this PR for a while and I was wondering that is there any reason (beyond performance) on why TZ="VALUE" is not relaxed with inner optional whitespaces (i.e TZ=" VALUE ")? Since such change passes all the current tests, this is a bit confusing to me.
This changes some behavior in an example like the following:
// prefixed whitespace
test(r#"TZ=" UTC-5:20:15""#, fixed_offset(0)); // current
test(r#"TZ=" UTC-5:20:15""#, fixed_offset(19215)); // with relaxed conditions
// prefixed whitespace
test(r#"TZ="UTC-5:20:15 ""#, Err(Backtrack(ContextError { context: [], cause: None }))); // current
test(r#"TZ="UTC-5:20:15 ""#, fixed_offset(19215)); // with relaxed conditions
Naturally, this can be generalized to the cases with :.
Whitespace relaxation can further improve in an unrelated example like: parse_datetime(" TZ=\"...\""). However in parse_datetime example, the user can easily just trim the input while removing the inner spaces of the quotation of this case is not as simple so that's why I think it's a quality improvement (if it is justified to begin with).
Example of changes that will relax this limitation:
diff --git a/src/items/timezone.rs b/src/items/timezone.rs
index 0414ee8..0009d17 100644
--- a/src/items/timezone.rs
+++ b/src/items/timezone.rs
@@ -16,6 +16,7 @@
use jiff::tz::{Offset, TimeZone};
use winnow::{
+ ascii::space0,
combinator::{alt, delimited, opt, preceded, repeat},
stream::AsChar,
token::{one_of, take_while},
@@ -25,7 +26,12 @@ use winnow::{
use super::primitive::{dec_uint, plus_or_minus};
pub(super) fn parse(input: &mut &str) -> ModalResult<TimeZone> {
- delimited("TZ=\"", preceded(opt(':'), alt((posix, iana))), '"').parse_next(input)
+ delimited(
+ ("TZ=\"", space0),
+ preceded(opt((':', space0)), alt((posix, iana))),
+ (space0, "\""),
+ )
+ .parse_next(input)
}
/// Parse a posix (proleptic) timezone string (e.g., "UTC7", "JST-9").
- Lenguaje dominante
- Rust
- Estrellas
- 37
- Forks
- 42
- Merge medio
- 17 h 48 min
- PR fusionados (30 d)
- 8
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de uutils/parse_datetime
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
uutils/parse_datetime#317 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
uutils/parse_datetime#279 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
uutils/parse_datetime#160 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
-
Fuzzer instructions confusingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
uutils/parse_datetime#82 ·
Los mantenedores suelen responder en 1 día
-
Cargo test fails at 0:20 JSTAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
uutils/parse_datetime#36 · 4 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de uutils/parse_datetime
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
arkworks-rs/algebra#1161 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
lbjlaq/Antigravity-Manager#3525 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Registry Scheduling: startup logging goes to stdout, colliding with a stdout audit destinationAbiertoagent-ready area:platform bug criticality:p3 rust triage:needs-implementation
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
registrystack/registry-stack#1583 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
Docs: "Work with Codex from anywhere" page still claims Windows mobile support is "coming soon"Abiertoapp documentation remote windows-os
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día