duydao / Text-Pastry

Extend the power of multiple selections in Sublime Text. Modify selections, insert numeric sequences, incremental numbers, generate uuids, date ranges, insert continuously from a word list and more.
MIT License
832 stars 46 forks source link

Fix date range not correctly parsing start date #60

Closed mpcabd closed 6 years ago

mpcabd commented 7 years ago

If the start date is in a different format than the one in the regex in line 904, the start date will not be taken, which is not correct, it should be taken and parsed from text.

duydao commented 7 years ago

Hi @mpcabd

Thanks for your contribution! I'm not sure if I understand you correctly, could you provide an example as use-case?

Thanks for using Text Pastry!

mpcabd commented 7 years ago

Hi @duydao,

Running days 2017-08-01 x5 with this configuration

{
    "date_format": "%Y-%m-%d",
    "parse_date_formats":
    [
        "%Y-%m-%d",
        "%d.%m.%Y"
    ]
}

used not to work before my patch, it always generated starting from the current date instead of starting from the date I provided, that's because 2017-08-01 does not match the regex '^([\\d]{1,2}[\\.-/][\\d]{1,2}[\\.-/][\\d]{1,4}) ?(.+)?$', but I believe the regex is not needed anymore when you can use parse_date.

Dakkers commented 6 years ago

any update on this? same issue for me