Skip to content

docs(readme): fix DiffForHumans output and gitcode import path in the example - #399

Merged
gouguoyin merged 1 commit into
dromara:masterfrom
Kernel-Hunter:readme-diffforhumans-output
Nov 16, 2026
Merged

gouguoyin merged 1 commit into
dromara:masterfrom
Kernel-Hunter:readme-diffforhumans-output

Conversation

@Kernel-Hunter

Copy link
Copy Markdown
Contributor

The quick start example says DiffForHumans() on a date one month in the past returns 1 month before, and 1 月前 with the zh-CN locale. Running the example on master and on v2.7.1 prints this instead:

carbon.Parse("2020-07-05 13:14:15").DiffForHumans()                      // 1 month ago
carbon.Parse("2020-07-05 13:14:15").SetLocale("zh-CN").DiffForHumans()  // 1 个月前

(with SetTestNow(carbon.Parse("2020-08-05 13:14:15.999999999")) as in the example). A past date goes through the ago key ("%s ago" in lang/en.json, "%s前" in lang/zh-CN.json), and the zh-CN month unit is "%d 个月". before is only used by DiffForHumans(other) when comparing two dates.

While there I also fixed the gitcode import line in the English, Japanese and Korean READMEs, which said gitcode.com/dromara/gitcode/v2. The Chinese README already has gitcode.com/dromara/carbon/v2.

I changed README.src.md and the four generated READMEs the same way.

@gouguoyin
gouguoyin merged commit 1ef0946 into dromara:master Nov 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants