Skip to content

Formatting Date for Display #12011

Discussion options

You must be logged in to vote

The output for

date.formatDate('2022-04-01', 'dddd - MM/DD/YYYY - HH:mm:ss')

is: Friday - 04/01/2022 - 03:00:00 on my machine. The output was different for your case, so let me explain the reason.

2022-04-01 is not a date object or a UNIX timestamp, it's a timestamp string.

From Quasar Date Utils docs:

Most Quasar date functions take as parameter either a Unix timestamp or a String representing a date which needs to be parsable by the native JS Date constructor.

So, it takes us to MDN docs for Date() constructor:

Note: Parsing of date strings with the Date constructor (and Date.parse(), which works the same way) is strongly discouraged due to browser differences and inconsistencies.

  • S…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@CynthiaBlue
Comment options

@CynthiaBlue
Comment options

Answer selected by yusufkandemir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants