Comments (13)
@iamkun Yep using ISO would format is a great advice, but some (me :D) have to deal with data from other sources which doesn't support the ISO date format.
from dayjs.
@iamkun ✔️ I will try to build one.
from dayjs.
@atomfrede, you can have a look at #340. It is my (unfinished) implementation. Only alpha-numeric non-localizable format tokens are supported, which are usually the only ones needed in enterprise applications. Recognition of localizable tokens, like "January" is missing.
from dayjs.
maybe some one need this feature, but still I recommend using ISO date format always.
from dayjs.
Is someone working in that feature (if not I can try to do it), as I try to get rid of moment in https://www.jhipster.tech/ which is part of the react validation lib which relies on that specific moment api (moment('2018-02-01', 'YYYY-DD-MM')
) to check if the date entered in a component is a valid date (and conforms the specified format).
from dayjs.
@atomfrede That would be nice. Besides, a plugin might be better. e.g. customFormatParser
from dayjs.
@atomfrede Cheers
from dayjs.
I also started using this till i found out that i can't parse back to date from my format.
from dayjs.
There are two usage scenarios for parsing in my application:
- Construct
dayjs
from a persistent storage. The strings come in the fixed ISO format. No problem. - Construct
dayjs
from the date picker output. The strings come in a customizable user-specific format. Big problem.
The second scenario needs a custom parsing.
@atomfrede, thanks, you'll save me time to implement the customFormatParser
myself :-) After the three PRs I posted, this is the last feature that I need to start using Day.js instead of Moment.js.
from dayjs.
Hey guys! @iamkun thanks for so lightweight lib.
@prantlf great and so wanted feature! waiting for your pr to be approved and merged.
from dayjs.
Sometimes, the date is user provided.
Also, is pretty strange that both '2005-02-18' and '02-18-2018' are valid dates.
from dayjs.
I'm dying to use this library instead of momentjs! But I really need this feature to be implemented before I can switch. Bundle size & tree shaking means a lot at the moment.. ;)
If anyone is working on it, let me know if and how I can help :)
from dayjs.
🎉 CustomParseFormat plugin is supported and included in version 1.8.0 🎉
The release is available on:
from dayjs.
Related Issues (20)
- dayjs(input, format).valueOf() result is wrong
- dayjs('02:08', 'HH:mm') browser version get null
- `YYYY-WW` format of 29 Dec 2019 is `2019-01`
- Version 1.11.10 - dayjs_esm__webpack_imported_module_0__.default)(...).utc is not a function HOT 1
- 希望支持yyyy和dd HOT 2
- TimeZone issue on Dayjs-values initially created before DST
- dayjs.add() behaves incorrect with timezones HOT 4
- [Feature request] Minified plugins
- dayjs.tz(time, timezone), when time contains time zone, the result is incorrect
- Unable to edit year when dayjs is used with <input type="date" /> value binding
- chain call functions dayjs、tz、hour、minute return incorrectly
- Is there an equivalent for utcOffset(offset: number | string, keepLocalTime: boolean) in DayJS with typescript? HOT 1
- Incorrect abbreviations for the names of the days of the week in Ukrainian localization HOT 2
- Isoweek bug when customParseFormat is active HOT 1
- Invalid duration when using partial object parameter in the creator HOT 1
- dayjs("2024-04-21T16:00:00Z").tz("Asia/Shanghai").format('YYYY.MM.DD') does not work on android wechat miniprogram (微信小程序) HOT 1
- Can't input negative years HOT 8
- Chinese Translation HOT 2
- Export `dayjs.Dayjs` in source to keep the same as type definition
- Check of an invalid date returns true on Firefox (isValid())
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dayjs.