Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Date] Dates with single digit preceded by space cannot be parsed #165

Closed
ohaibbq opened this issue Feb 6, 2024 · 0 comments · Fixed by #166
Closed

[Date] Dates with single digit preceded by space cannot be parsed #165

ohaibbq opened this issue Feb 6, 2024 · 0 comments · Fixed by #166

Comments

@ohaibbq
Copy link
Contributor

ohaibbq commented Feb 6, 2024

The %e %k and %l elements expect a leading space when the value is a single digit; but also permit a leading space for 2 digit numbers when available.

Formatters also do not currently include the leading space.

{
	name:         "parse timestamp with %k",
	query:        `SELECT PARSE_TIMESTAMP("%k", " 9");`,
	expectedRows: [][]interface{}{{createTimestampFormatFromString("1970-01-01 09:00:00+00")}},
},
{
	name:         "parse timestamp with %k",
	query:        `SELECT PARSE_TIMESTAMP("%k", " 9");`,
	expectedRows: [][]interface{}{{createTimestampFormatFromString("1970-01-01 09:00:00+00")}},
},
{name: "parse_timestamp with %D",
	query:        `SELECT PARSE_TIMESTAMP("%D", "02/02/99");`,
	expectedRows: [][]interface{}{{createTimestampFormatFromString("1999-02-02 00:00:00+00")}},
},
{
	name:  "parse timestamp with %p",
	query: `SELECT PARSE_TIMESTAMP("%I%p", "9am"), PARSE_TIMESTAMP("%I%p", "12am"), PARSE_TIMESTAMP("%l%p", " 2am"), PARSE_TIMESTAMP("%I%p", "10PM");`,
	expectedRows: [][]interface{}{{
		createTimestampFormatFromString("1970-01-01 09:00:00+00"),
		createTimestampFormatFromString("1970-01-01 00:00:00+00"),
		createTimestampFormatFromString("1970-01-01 02:00:00+00"),
		createTimestampFormatFromString("1970-01-01 22:00:00+00"),
	}},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant