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.

YY maps 2018 to 20

See original GitHub issue

Hi there, I’m trying to standardise a bunch of records which can contain the patterns dd/mm/yyyy, d/mm/yy etc.

When using the example input of “15/01/2019”

print arrow.get("15/01/2019", ["D/M/YY","D/M/YYYY"]).format('YYYY-MM-DD') outputs 2020-01-15, which seems to use “D/M/YY”. I would expect it to be ignored, since it doesn’t fit with the pattern of the data provided

Currently I’m getting around this by swapping around the array, but i’m not feeling great about the fragility here. print arrow.get("15/01/19", ["D/M/YYYY","D/M/YY"]).format('YYYY-MM-DD')

Suggestions: 1. If YY is specified, it looks for YY:YYYY (\/[0-9]{2,4}). If the pattern extends without a delimiter up to 4 characters, it’s treated as valid

If I could supply ,"D/M/YY$" I’d have a lot more confidence that the string will be correctly processed, regardless of where the pattern exists in the list.

If YY is specified, it strictly looks for YY. If the pattern extends without a delimiter, it’s treated as invalid and the pattern is skipped.

Please let me know if you need any more information here! Cheers, Adam

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
systemcatchcommented, Feb 17, 2019

Hey Chris, thanks for pointing that out! I thought I’d checked that in the initial bug report but after trying the use cases we’ve been working with here, the $ seems to solve them all. So is that just a small amendment to the docs then? Cheers, Adam From: Chris notifications@github.com Reply-To: crsmithdev/arrow reply@reply.github.com Date: Friday, 15 February 2019 at 10:24 am To: crsmithdev/arrow arrow@noreply.github.com Cc: Adam Rudd Adam.Rudd@myob.com, Mention mention@noreply.github.com Subject: Re: [crsmithdev/arrow] YY maps 2018 to 20 (#560) Quick follow up I was messing about with your suggestion number 2.

arrow.get(“15/01/2019”, [“D/M/YY”,“D/M/YYYY”]) <Arrow [2020-01-15T00:00:00+00:00]> arrow.get(“15/01/2019”, [“D/M/YY$”,“D/M/YYYY”]) <Arrow [2019-01-15T00:00:00+00:00]> arrow.get(“15/01/2019”, [“D/M/YY$”,“D/M/YYYY”]).format(‘YYYY-MM-DD’) ‘2019-01-15’ It seems to already work!? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub<#560 (comment)>, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXgIFDoadVhLAa-_PaxsfN3lU_1CR2X3ks5vNfAhgaJpZM4aHHzY. ________________________________ This email and any attachment are confidential. If you are not the intended recipient, please notify MYOB by reply email and delete this email. Please note that you must not access or use this email or any information in it. MYOB accepts no liability for viruses in this email or in any attachment to it.

Yeah I guess an update to the docs is order. To be honest I’m kinda surprised it works, probably to do with special regex characters now being handled better.

1reaction
adam-rudd-myobcommented, Feb 15, 2019

Hey Chris, thanks for pointing that out! I thought I’d checked that in the initial bug report but after trying the use cases we’ve been working with here, the $ seems to solve them all. So is that just a small amendment to the docs then?

Cheers, Adam

From: Chris notifications@github.com Reply-To: crsmithdev/arrow reply@reply.github.com Date: Friday, 15 February 2019 at 10:24 am To: crsmithdev/arrow arrow@noreply.github.com Cc: Adam Rudd Adam.Rudd@myob.com, Mention mention@noreply.github.com Subject: Re: [crsmithdev/arrow] YY maps 2018 to 20 (#560)

Quick follow up I was messing about with your suggestion number 2.

arrow.get(“15/01/2019”, [“D/M/YY”,“D/M/YYYY”])

<Arrow [2020-01-15T00:00:00+00:00]>

arrow.get(“15/01/2019”, [“D/M/YY$”,“D/M/YYYY”])

<Arrow [2019-01-15T00:00:00+00:00]>

arrow.get(“15/01/2019”, [“D/M/YY$”,“D/M/YYYY”]).format(‘YYYY-MM-DD’)

‘2019-01-15’

It seems to already work!?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/crsmithdev/arrow/issues/560#issuecomment-463843651, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXgIFDoadVhLAa-_PaxsfN3lU_1CR2X3ks5vNfAhgaJpZM4aHHzY.


This email and any attachment are confidential. If you are not the intended recipient, please notify MYOB by reply email and delete this email. Please note that you must not access or use this email or any information in it. MYOB accepts no liability for viruses in this email or in any attachment to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Maps
Find local businesses, view maps and get driving directions in Google Maps.
Read more >
A look back at 15 years of mapping the world - The Keyword
Fifteen years ago, we launched Google Maps as a useful way to help people get around. Working on Google's geo efforts for more...
Read more >
Yeah Yeah Yeahs - Maps (Official Music Video) - YouTube
REMASTERED IN HD!!Official Music Video for Maps performed by Yeah Yeah Yeahs.Download “ Maps ” off the album 'Fever To Tell' ...
Read more >
Maps - National Geographic
National Geographic has been publishing the best wall maps, travel maps, recreation maps, and atlases for more than a century. Explore more than...
Read more >
Adult Obesity Prevalence Maps | Overweight & Obesity - CDC
The CDC 2021 Adult Obesity Prevalence Maps for 49 states, ... 20% to less than 25% of adults had obesity in the District...
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