Giter Club home page Giter Club logo

date-utils's People

Contributors

a1eksandrk avatar alexeyw100 avatar chervyakovru avatar darkgenius avatar dividead avatar gravity-ui-bot avatar kalachevdev avatar korvin89 avatar valeras avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

a1eksandrk

date-utils's Issues

time zones abbreviations are not supported

there is a difference between moment and dayjs APIs

dayjs().tz('Europe/Moscow').format('z') // 'GMT+3’
moment(Date.now()).tz('Europe/Moscow').zoneAbbr() // 'MSK’

it seems that it could be a good feature to support timezones abbreviations

I think we can extend dayjs functionality by adding some flag: abbreviateTimezone: true/false and overriding .format() method as following:
format('z') returns GMT +3, after that if abbreviateTimezone flag is turned on, we search through the result string and replace GMT +3 with provided abbreviations

date-utils itself could provide some default abbreviations, like GMT +3 = MSK, however it would be great to have an ability to override default abbreviations

Breaks production build

My project stack:

  • Next 13.4.3
  • React 18.2.0

When i try to import @gravity-ui/date-utils in dev everything works fine, but production build breaks with these errors:

image

The ability to parse the date and time in UTC format

It would be useful to have a utility for working with the date in utc format. Something like the old version of working with a date or an analog in dayjs:

dayjs.utc('2023-12-31'); // '2023-12-31T00:00Z'
dayjs.utc('2023-12-31T00:00Z'); // '2023-12-31T00:00Z'

Allow custom relative date parser

I suggest adding parentheses for keywords and adding new keywords instead of a separator, for example now => now(), /d => today(), /w => week(), /M => month(), /y => year(). It will be more readable this way. Also, this syntax will be easier to convert.

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.