03-03-2017, 03:22 PM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Mar 2017
Device: none
|
REGEX And Dates
Hi,
I'm using the following regex to interpret the book titles created by my partner. (?P<title>[^-]*) - (?P<author>[^-]*) - (?P<series>[^-]*) - (?P<publisher>[^-]*) - (?P<published>.*) This will interpret a title such as the following: Lavender - Felicity Harper - Enchanting Tales - Endeavours Partnership - 02-03-2017.odt However, I have noticed that if the day portion of the date contains the digit 1, then the date will not be displayed in the Published metafield properly in the regex testing screen. 01-03-207 is reported as 02-03-2017 and 31-03-207 is reported as 30-03-2017. It does not matter which month I substitute. It does not matter whether I enter the date as YY-MM-DD or DD-MM-YYY or DD-MMM-YYYY. That it is a date is recognised but, for some reason, 1 and 31 are never pattern-matched. Is this me doing something wrong (I am no expert at regex!) or have I just discovered a bug? Many thanks in advance for any insights anyone can offer! Thomas. |
03-03-2017, 11:36 PM | #2 |
creator of calibre
Posts: 43,966
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It has to do with timezones. WHen parsing dates from strings, calibre ensures the month and year remain unchanged in all timezones, this means days of 01 have to become 02 otherwise in some timezones the month could be the previous month.
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to get your Kobo to use non-US dates | GeoffR | Kobo Reader | 167 | 10-11-2021 07:34 AM |
Dates in Calibre | the_callant | Library Management | 6 | 12-01-2013 03:50 PM |
Published - Dates | bigbird1227 | Plugins | 4 | 08-21-2011 06:54 AM |
Published Dates | bigbird1227 | Library Management | 7 | 06-10-2011 10:40 AM |
Dates in Russian (?) | Roger Wilmut | Calibre | 10 | 11-24-2008 06:22 PM |