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.

Custom parsing doesn't work well

See original GitHub issue

Describe the bug

import dayjs from "dayjs";
import customParseFormat from 'dayjs/plugin/customParseFormat';
import AdvancedFormat from 'dayjs/plugin/advancedFormat';

dayjs.extend(AdvancedFormat);
dayjs.extend(customParseFormat);

dayjs("2019 May 15 10:31:18 WAT +01:00", "YYYY MMM DD HH:mm:ss Z")

returns Invalid Date

Expected behavior

import customParseFormat from 'dayjs/plugin/customParseFormat'

dayjs.extend(customParseFormat)
dayjs("2019 May 15 10:31:18 WAT +01:00", "YYYY MMM DD HH:mm:ss Z")

should return May 15, 10:31 AM like moment js

Information

  • Day.js v1.8.16
  • OS: MacOS Mojave 10.14.5
  • Browser: Chrome 74.0.3729.157
  • Time zone: GMT+01:00 WAT(West African Time)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
iamkuncommented, May 22, 2019

please use customParseFormat plugin to escape WAT string, check the code in my upper comment.

1reaction
ashinzekenecommented, May 20, 2019

Can you try. Runkit shows loading infinitely for me

var dayjs = require("dayjs")
dayjs("2019 May 15 10:31:18 WAT +01:00").format("YYYY/MM/DD H:mm")
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Parsing Tool | InsightIDR Documentation
Custom Parsing Tool. The Custom Parsing Tool gives you the ability to create custom parsing rules to extract log data that is most...
Read more >
jQuery Tablesorter - custom parser not working - Stack Overflow
I'm trying to write a custom parser for the jQuery plugin, Tablesorter. The idea is for it to sort the numbers in descending...
Read more >
How to Build a Custom Parser - Packet Coders
A guide into the world of parsing. Learn how to build your own custom parser from scratch. ... If you haven't used capture...
Read more >
Directory parsing does not work for SFTP hosts
1, custom directory parsing scripts are ignored when attempting to parse remote SFTP hosts. The default parsing behavior will provide incorrect ...
Read more >
Parsing rules seems not applied to logs - Log Management
Then I went to Manage Parsing and added a custom parser. ... After applying the parsing rule, newly ingested logs do not have...
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