mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-08 22:15:08 +00:00
langchain[patch]: fix a bug where now.replace(day=now.day - 1)
would raise a ValueError
when now.day
is equal to 1 (#31878)
This commit is contained in:
parent
15dc684d34
commit
64815445e4
@ -1,4 +1,4 @@
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
from langchain_core.exceptions import OutputParserException
|
||||
from langchain_core.output_parsers import BaseOutputParser
|
||||
@ -31,7 +31,7 @@ class DatetimeOutputParser(BaseOutputParser[datetime]):
|
||||
[
|
||||
now.strftime(self.format),
|
||||
(now.replace(year=now.year - 1)).strftime(self.format),
|
||||
(now.replace(day=now.day - 1)).strftime(self.format),
|
||||
(now - timedelta(days=1)).strftime(self.format),
|
||||
]
|
||||
)
|
||||
except ValueError:
|
||||
|
Loading…
Reference in New Issue
Block a user