question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for missing format string in `useDateFormat()` from `dayjs`

See original GitHub issue

Clear and concise description of the problem

It’s nice to have some of the missing format string in useDateFormat() as per dayjs for common use case, such as:

MMM | Jan-Dec | The abbreviated month name
MMMM | January-December | The full month name
dd | Su-Sa | The min name of the day of the week
ddd | Sun-Sat | The short name of the day of the week
dddd | Sunday-Saturday | The name of the day of the week
A | AM PM |  
a | am pm

Reference: https://day.js.org/docs/en/display/format

Also, with the missing format, we could potentially reduce overall bundle size by not bundling dayjs for common formatting use case.

Suggested solution

Support the proposed missing format string.

Alternative

No response

Additional context

https://day.js.org/docs/en/display/format

Validations

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andrewspycommented, May 31, 2022

There is some misunderstanding here, I don’t see how “Jan-Dec”, “Sun-Mon” or “am/pm” involve any locale here. It’s a purely formatting option as opposed to presenting it as numbers such as 1-12 (month), 0-6 (weekday), and 0-23 (hours in am/pm). it’s simply a mapping of objects/arrays.

If you mean translating the date format into another locale/language, I do agree that would certainly be out of scope for VueUse.

0reactions
stale[bot]commented, Sep 14, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

String + Format
If you know the format of an input string, you can use that to parse a date. This dependent on CustomParseFormat plugin to...
Read more >
How do I format a date in JavaScript? - Stack Overflow
formatString : A format string in the same format expected by the strftime() function in C. var today = new Date(); today.toLocaleFormat('%d-%b-%Y'); ...
Read more >
The Complete Guide to Day.js - Mirza Leka - Medium
Custom Parse Format extends dayjs() the constructor to support custom formats of input strings. Basically, it allows us to pass the date ...
Read more >
Working with Dates and Times with Day.js
Day.js Support in JavaScript Community. ... When we run Day.js in the browser, the .format() method returns a string in ISO format.
Read more >
Template::Plugin::Date
Plugin to generate formatted date strings ... locale = 'en_GB' use_offset = 1) %] # specify default format to plugin [% USE date(format...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found