Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would be great per moments.js if one could provide a .Format string like "LTS" directly... #11

Open
Simonl9l opened this issue Apr 22, 2021 · 5 comments

Comments

@Simonl9l
Copy link

please see docs here

@Eonasdan
Copy link
Owner

there's this:

LongDateFormat = new LongDateFormat

@Simonl9l
Copy link
Author

Simonl9l commented Apr 23, 2021

Yes found that in the code, but how does one selectively invoke it...docs are not clear.

@Eonasdan
Copy link
Owner

It's been 6 years since I wrote this and I'm surprised people are actually using it lol. I'm looking at the code again and I think the reason I didn't include a "format" function is because the native DateTime object already provides this. That said I think you could do this: m.DateTime().ToString(m.Language.LongDateFormat.Lts) where m = new Moment().

Let me know if that helps.

@Simonl9l
Copy link
Author

CurrentlyI've taken a private fork and made it DotNet Standard. (that Framework 3.5). The JS original would just take format strings (like TLS) so if you have a use case where users profile the frame for their data the .Format("LTS") etc. method
is useful.

The logic as basically good and reusable, and save reinventing, the JS original is widely popular, and is Numerals.js and Humaize.js. the latter DotNet port is great, and have also privately forked the Numerals port out there and added the "bytes" formatter.

Having at least at latest DotNet versions might encourage more users if that is what you want to do...

If I get the time at some point I can look to push my fork back as a pull request...

@Eonasdan
Copy link
Owner

Yeah if I had time, I'd rewrite it to use .net 5 and probably provide extensions to DateTime instead of creating a new object. I'm currently putting in a lot of overtime in my regular job and I'm working on a new version of my date picker. If there's interest, I could add a rewrite of this to my long term side project planning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants