iamkun / iamkun/dayjs

moment incompatibility, very strange issues

Open
#2,348 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
A clear and concise description of what the bug is.

Looks like minor formatting oddities

```
test/cli.test.js .................................... 60/62
time: simple.log local long
not ok should be equal
--- wanted
+++ found
-[2012-02-08T12:56:52.856-10:00] INFO: myservice/123 on example.com: My message
+[2012-02-08T12:56:52.856-10:00[]] INFO: myservice/123 on example.com: My message
compare: '==='
at:
line: 117
column: 15
file: test/cli.test.js
stack: |
test/cli.test.js:117:15
ChildProcess.exithandler (node:child_process:390:7)
ChildProcess.emit (node:events:527:28)
maybeClose (node:internal/child_process:1092:16)
Socket. (node:internal/child_process:451:11)
Socket.emit (node:events:527:28)
Pipe. (node:net:709:12)
source: |
t.equal(stdout,

time: simple.log utc short
not ok should be equal
--- wanted
+++ found
-22:56:52.856Z INFO myservice: My message
+12:56:52.856Z INFO myservice: My message
compare: '==='
at:
line: 149
column: 15
file: test/cli.test.js
stack: |
test/cli.test.js:149:15
ChildProcess.exithandler (node:child_process:390:7)
ChildProcess.emit (node:events:527:28)
maybeClose (node:internal/child_process:1092:16)
Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
source: |
t.equal(stdout,

```

This is in the bunyanjs source code base. Literally replace the word moment with day. All tests bar two pass (which is very good btw) 👍

**Expected behavior**
A clear and concise description of what you expected to happen.

switch momentjs for dayjs, it works, same tests pass.

**Information**
- Day.js Version `1.11.8`
- OS: `Darwin UKLOMAC055.local 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64`
- Browser `N/A` (nodeJS 18)
- Time zone: both `unset` (no TZ env var) and `TZ=UTC` - (may affect others)

Contributor guide

Open the contributing guide

Research direction

Start with the failing cases in test/cli.test.js at lines 117 and 149, then run the CLI tests with the reported Node.js and time-zone settings. Compare the expected and found timestamp output and determine the scope of the moment/dayjs incompatibility; done means the two failures pass without breaking the other CLI tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.