diff options
author | 2023-03-30 02:41:11 +0200 | |
---|---|---|
committer | 2023-03-29 17:41:11 -0700 | |
commit | 95cb2b2ac2bf978bedbeaa968c60b44c6c512898 (patch) | |
tree | 4ff959fccd3b2a8fb1f42f99ee065605de73a48b /src/bun.js | |
parent | b0e08533608def8dfc4674de03835d951b6626d2 (diff) | |
download | bun-95cb2b2ac2bf978bedbeaa968c60b44c6c512898.tar.gz bun-95cb2b2ac2bf978bedbeaa968c60b44c6c512898.tar.zst bun-95cb2b2ac2bf978bedbeaa968c60b44c6c512898.zip |
Fix date format (#2422) (#2474)
* Fix date format (#2422)
* Add unit tests for #2422
Diffstat (limited to 'src/bun.js')
-rw-r--r-- | src/bun.js/bindings/exports.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/bun.js/bindings/exports.zig b/src/bun.js/bindings/exports.zig index d4401865d..8641dda3a 100644 --- a/src/bun.js/bindings/exports.zig +++ b/src/bun.js/bindings/exports.zig @@ -2304,7 +2304,10 @@ pub const ZigConsoleClient = struct { // in the code for printing dates, it never exceeds this amount var iso_string_buf: [36]u8 = undefined; var out_buf: []const u8 = std.fmt.bufPrint(&iso_string_buf, "{}", .{str}) catch ""; - if (out_buf.len > 2) { + + if (strings.eql(out_buf, "null")) { + out_buf = "Invalid Date"; + } else if (out_buf.len > 2) { // trim the quotes out_buf = out_buf[1 .. out_buf.len - 1]; } |