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.

Propped value of type String is not formatted correctly.

See original GitHub issue

When propping a String value to the component with a format like so: <datepicker format="dd/MM/yyyy" value="01/03/2017"></datepicker>

The component doesn’t use the format propped to it, which creates an incorrect date. It will show “03/01/2017” instead of the value propped. I checked the source codes and it looks like the issue is on Datepicker.vue file.

formattedValue () {
   if (!this.selectedDate) {
       return null
   }
   return DateUtils.formatDate(new Date(this.selectedDate), this.format, this.translation)
},

On Datepicker.vue, it passes new Date(this.selectedDate) as the first parameter, it uses the default date format of the Date object which causes the component to return the incorrect value.

Thanks! 👍

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
gezichenshancommented, Jan 12, 2018

So, is there a format string for the value? I dont want it to be Date object. I want it to be like “2018-01-12”

0reactions
roncabalcommented, Jul 12, 2017

Got it. Maybe it is best to put the string format on the read me file to avoid confusion? 😄

Anyway, thanks for checking on my issue. Also, thanks for building this component! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - How to nicely format floating numbers to string without ...
Have a look at String. format. You need to use the correct format type, float in this instance. Look at my above answer....
Read more >
Improved interpolated strings - C# 10.0 draft specifications
We introduce a new pattern for creating and using interpolated string expressions to allow for efficient formatting and use in both general ...
Read more >
Python 3's f-Strings: An Improved String Formatting Syntax ...
As of Python 3.6, f-strings are a great new way to format strings. ... is verbose and leads to errors, like not displaying...
Read more >
PEP 3101 – Advanced String Formatting
Within a format string, each positional argument is identified with a number, starting from zero, so in the above example, 'a' is argument...
Read more >
Template literals (Template strings) - JavaScript | MDN
Template literals are literals delimited with backtick (`) characters, allowing for multi-line strings, string interpolation with embedded ...
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