Giter Site home page Giter Site logo

dayjs-website's Introduction

Day.js

Fast 2kB alternative to Moment.js with the same modern API


Day.js website repo.

dayjs-website's People

Contributors

4limirzaei avatar abdelrahman-shahda avatar akbarbakhshi avatar andgreendigital avatar armanio avatar ayuhito avatar benlongo avatar bepo65 avatar brockklein avatar coolcolduk avatar davidabsilva avatar dcyou avatar dudintv avatar elijahpepe avatar epolishchuk avatar g1eny0ung avatar glennforrest avatar humbertomendes avatar iamkun avatar ibolton336 avatar jennifer-shehane avatar jfbrennan avatar josephzidell avatar keepzen avatar mareksuscak avatar marnixhoh avatar svsylmz avatar weevil111 avatar xvaara avatar zouyoushun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dayjs-website's Issues

RelativeTime thresholds customization

// 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

"isValid" returns true on invalid date.

        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 ?

calendar giving wrong descriptions

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.

Feature: Having a copy button next to the code sample

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:

Screen.Recording.2022-12-15.at.9.01.47.AM.mov

Translation Contributions Wanted 🙋🙏

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.

Plugin name capitalization

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.