Skip to content

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
olivroy committed Dec 6, 2024
1 parent f0d2764 commit 91422ef
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/utils-date_time_parse.R
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ long_tzid_to_tz_str <- function(long_tzid, input_dt) {
tzdb$zone_name == long_tzid, c("date_start", "gmt_offset_h")]

if (nrow(tzdb_entries_tzid) == 0L) {
return(NA_character_)
return(NULL)
}

input_date <- as.Date(input_dt)
Expand Down
20 changes: 18 additions & 2 deletions tests/testthat/test-fdf_ftf.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,24 @@ test_that("`flex_*_lst` can be used in `fdt()`", {

test_that("fdt() works in all contexts", {
expect_equal(
bigD::fdt("2024-03-01", format = "GyMMMEd", use_tz = "America/Toronto"),
fdt("2024-03-01", format = "GyMMMEd", use_tz = "America/Toronto"),
"AD2024MarFri1"
)

# Copy of a test in gt
expect_equal(
fdt(as.POSIXlt(
c(
"1970-01-01 15:35:00", "1970-01-01 16:36:00", "1970-01-01 17:37:00",
"1970-01-01 18:38:00", "1970-01-01 19:39:00"
),
tz = "GMT"
),
format = "EBhms"
),
c(
"Thu 3:35:00 in the afternoon", "Thu 4:36:00 in the afternoon",
"Thu 5:37:00 in the afternoon", "Thu 6:38:00 in the evening",
"Thu 7:39:00 in the evening"
)
)
})

0 comments on commit 91422ef

Please sign in to comment.