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.

What if i dont want ISO date format when using custom format at moment.js

See original GitHub issue

When using owl-date-time picker with custom format the value which is validated with moment.js should be in format YYYY-MM-DD due to this code. var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4}-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; At line: 2161(the second "-"character in regex does not allow to have different format like “/” or “*”).

What if the date format at the class in .ts file is different like: YYYY/MM/DD

When converting to different format the value on view is removed (I know what is causing all this problem in present code) but i wanted to know a feasible solution for this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
DanielYKPancommented, Jun 12, 2018

Do not show image, show the actual app link.

As I got from your images, you may did this wrong.

export const MY_CUSTOM_FORMATS = {
    datePickerInput: 'DD/MM-YYYY',
    monthYearLabel: 'MMMM Y',
};

You have to provide your custom formats like this:

export const CUSTOM_DATE_TIME_FORMATS = {
    parseInput: 'your custom value',
    fullPickerInput: 'your custom value',
    datePickerInput: 'your custom value',
    timePickerInput: 'your custom value',
    monthYearLabel: 'your custom value',
    dateA11yLabel: 'your custom value',
    monthYearA11yLabel: 'your custom value',
};
0reactions
Rachit-rkbcommented, Jun 12, 2018

OK, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I format a date as ISO 8601 in moment.js?
toISOString converts to a Date object, sets to UTC then uses the native Date prototype function to output ISO8601 in UTC with milliseconds...
Read more >
Docs - Moment.js
We may choose to not accept corrections to locale strings or localized date formats, especially if they have been argued successfully for their...
Read more >
How to format dates without Moment.js - Dawntraoz
In this post I want to tell you how I got rid of the moment library when I found new alternatives with smaller,...
Read more >
Javascript Dates Manipulation with Date-fns - Section.io
Date locale; Time zones; Date arithmetic; Date comparisons, and other important applications of date-fns functions. Date Format. Date formatting ...
Read more >
How to Format Date in JavaScript with Moment.JS
If you are including the script in HTML, the moment object will be available globally, so you do not have to import it....
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