Coder Social home page Coder Social logo

Missing several format options about dayjs HOT 5 CLOSED

iamkun avatar iamkun commented on May 6, 2024
Missing several format options

from dayjs.

Comments (5)

Frondor avatar Frondor commented on May 6, 2024

In my humble opinion, the only useful ones in that list are h/hh and k/kk (and still not sure about them, can't think on an use case). The rest doesn't look like human-friendly formats.

from dayjs.

schiem avatar schiem commented on May 6, 2024

I would tend to agree, I think that Q, DDD/DDDD, X/x, and S/SS/SSS are definitely not necessary. I think if h/hh is included, then a/A should probably be included as well, or you lose the ability to show specific times (1:00 vs 1:00 AM).

"Do" is kind of up in the air for me, because I've had clients who've insisted on having the ordinal (1st, 2nd, 3rd, etc) shown, but it's something that a user could implement on their own. I think most of it comes down to "what should be provided by a library" vs. "what can a user be reasonably expected to write themselves," and I think that's mostly up to the owner of the repo.

from dayjs.

iamkun avatar iamkun commented on May 6, 2024

I tend to agree adding h/hh & a/A(with local). And leave the rest formats to a separate plugin, maybe called AdvFormat
It will be nice if we implement a plugin system like this.

import { AdvFormat } from 'dayjs/plugin'
dayjs.extend('AdvFormat') // a plugin might add a new API or overwrite the existing one
//here it just overwrite the core.format
dayjs.format('Do SSS ... something less useful format')

from dayjs.

schiem avatar schiem commented on May 6, 2024

I've updated #68 to only have AM/PM and 12 hour time support, with additional options included in another plugin (and the addition of a plugin system).

from dayjs.

schiem avatar schiem commented on May 6, 2024

The PR from #68 has been split into #91 and #92.

from dayjs.

Related Issues (20)

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.