Fast 2kB alternative to Moment.js with the same modern API
Day.js website repo.
⏰Day.js website repo
Home Page: http://day.js.org/
License: MIT License
Fast 2kB alternative to Moment.js with the same modern API
Day.js website repo.
Shouldn't we add a branch 'next' to this repository for changes that affect dayjs 2.0 only (e.g. for required plugins for some units in 'add')?
Thanks for your dayjs project.
I want get simplified chinese documents,but I could't find it in this repository.
Can you give me some help?Thank you very much for your efforts into dayjs.
Ive noticed while going through the documentation for Day.js that plugins seem to follow camelCase with the initial letter lowercase, such as localizedFormat
. However, in the documentation table of contents, the list of Plugins all start with an uppercase letter, and in other places in the documentation (such as https://github.com/dayjs/dayjs-website/blob/master/docs/display/format.md), the first letter is capitalized, which is a bit confusing. Should these be changed so the first letter is always lowercase, regardless of where it is in the documentation?
In the List of all available units on this page (https://github.com/dayjs/dayjs-website/blob/master/docs/display/difference.md) , the day description is incorrect as Day of Week (Sunday as 0, Saturday as 6). The argument day returns the number of days difference.
The documentation of startOf does not include information what is returned by the function (Monday, Sunday, dependant on user settings)?
https://github.com/dayjs/dayjs-website/blob/master/docs/manipulate/start-of.md
very good
const testDate = "2021-07-07"
console.log(dayjs(testDate).isValid())
//Output : true
const testDate = "abc07-07"
console.log(dayjs(testDate).isValid())
//Output : false
const testDate = "abc-07-07"
console.log(dayjs(testDate).isValid())
//Output : true <-- Problem
Or does it intended to only check for the date format ?
The min()
and max()
methods can return null
(as a result of the .sortBy()
) but this is not mentioned in the documentation. The .d.ts
file also only indicates that it will return a Dayjs
(not Dayjs | null
).
Es module is becoming the mainstream now and this makes copy/paste code easier 😊
https://github.com/dayjs/dayjs-website/blob/master/docs/plugin/advanced-format.md
When I use:
dayjs().format('z')
I get GMT+1
, but the docs suggest that I should get GMT
.
Day.js users come from all around the world, so I will happily accept translations from other languages for this project. And your work will affect thousands of daily users of Day.js.
We are now hosting the whole translation process on https://crowdin.com/project/dayjs
Feel free to leave a comment if you want to join us. Thanks.
You can find me live here: https://gitter.im/iamkun/dayjs
Note: We have some previous translation here that might help https://github.com/iamkun/dayjs/tree/dev/docs.
Note2: If there's no language you are looking for on Crowdin page, please let me know and I'll add it.
If you follow the documentation and pass a date to the calendar method, then the relative description for yesterday is incorrect:
Consider:
dayjs() => Fri Mar 06 2020 14:05:09 GMT+0000 (Greenwich Mean Time)
dayjs().calendar(dayjs('2020-03-06')) => "Today at 2:05 PM" // correct dayjs().calendar(dayjs('2020-03-05')) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday
The same issue is present in the extended syntax:
`dayjs().calendar(dayjs('2020-03-05'), {...props}) => "Tomorrow at 2:05 PM" // wrong 05 should be yesterday``
If you pass a date to the dayjs constructor it seems to work fine.
dayjs(dayjs('2020-03-06')).calendar() => "Today at 12:00 AM" // correct dayjs(dayjs('2020-03-05')).calendar() => "Yesterday at 12:00 AM" // correct
Similarly:
dayjs(dayjs('2020-03-05')).calendar(null, {...props}) => "Yesterday at 12:00 AM" // correct
It seems this is not limited to just 'yesterday' but other descriptions for days of week etc.
I would like to propose including dayjs
documentation in DevDocs: API Documentation Browser, but their rules require including a link to the proposed documentation license (https://trello.com/c/PVnfdeaN/26-suggest-new-docs-here), which I cannot find here in this repo.
Please add a license file to the documentation. Thank you.
In the advance Formatting options the small 'z' is used to show the "Abbriviated named offset" like - IST for Indian Standard Time. But, this is not working.
Also adding the codesandbox : https://codesandbox.io/s/thirsty-lamport-d8q96x?file=/src/App.js
how to set the start of the week to Monday
http://localhost:3000/docs/en/installation/node-js
To get started with Day.js in your Node.js project, simply add the dependency with NPM.
dayjs('2019-01-25').toDate() returns 2019-01-24T22:00:00.000Z
After merging pull request #1255 to solve issue #416 on the main repo, the website documentation is missing preParsePostFormat
plugin documentation.
The plugin needs to be loaded in order to transform language numerals such as ar
displaying "Eastern Arabic numerals" ۰۱۲۳۴۵۶۷۸۹
instead of "Arabic numerals" 0123456789
.
All links from the translate button on the website refers to GitHub issue e.g. https://github.com/dayjs/dayjs-website/issues/5/zh-CN
instead of https://crowdin.com/project/dayjs/zh-CN
// strict thresholds
var thresholds = [
{ l: 's', r: 1 },
{ l: 'ss', r: 59, d: 'second' }, // FIX : 'ss' is invalid format
{ l: 'm', r: 1 },
{ l: 'mm', r: 59, d: 'minute' },
{ l: 'h', r: 1 },
{ l: 'hh', r: 23, d: 'hour' },
{ l: 'd', r: 1 },
{ l: 'dd', r: 29, d: 'day' },
{ l: 'M', r: 1 },
{ l: 'MM', r: 11, d: 'month' },
{ l: 'y' },
{ l: 'yy', d: 'year' }
]
https://day.js.org/docs/en/customization/relative-time#:~:text=strict%20thresholds
this example is not working properly. Because the 'ss' format doesn't exist in locale file.
Example
https://runkit.com/tolgacesur/5eeb8a2dd16b9e00131d4baf
PR : #13
Description:
This proposal is to add a "Copy" button to the top-right corner of code sample boxes in the official documentation. The button's text should change to "Copied" when clicked, allowing the user to paste the copied code wherever they like. An example of this can be seen in the VueJS documentation.
UAT:
Given
: A Copy button is displayed in the top-right corner of the code sample boxes.
When
: a user clicks on the button its text should change to Copied.
Then
: the user can paste the copied code anywhere he/she wants.
Please let me know if this proposal is clear and if there are any additional details that need to be included. Thanks!
Visual example from VueJS docs:
add <script src="https://unpkg.com/dayjs/dayjs.min.js"></script>
in doc website can helpful quick validation dayjs
in browser F12
I find position in
dayjs-website/website/siteConfig.js
Line 85 in 8336b89
but have a quick way to load all plugin in the browser ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.