Comments (4)
What would you want to be able to do with them? I think that might determine how we would implement this.
from lubridate.
I support this. I ran into this issue yesterday and it was incredibly frustrating. At the very least, lubridate should have graceful error messages. Consider:
> parse_date_time("April-2012", "%B-%Y")
Error in formats[[1]] : subscript out of bounds
Python's datetime library:
>>> from datetime import datetime
>>> datetime.strptime("April-2012", "%B-%Y")
datetime.datetime(2012, 4, 1, 0, 0)
Using the first date of a month is a good default behavior until NA date components can be added.
from lubridate.
First, this is a bug, and the helpful message were supposed to happen later. Second, it actually occurs because the underlying C implementation of stprptime doesn't parse partial dates of these sort. This is expectedly mentioned in the documentation of parse_date_time
.
from lubridate.
New parser supports partial dates for numeric formats:
> parse_date_time(c("2/10","2/11"), "my")
[1] "2010-02-01 UTC" "2011-02-01 UTC"
Alphanumeric formats will unlikely be ever supported as it would require managing locales explicitly. Users can simply append 01 in front of truncated dates to overcome the issue.
from lubridate.
Related Issues (20)
- tests failing HOT 6
- warning in parse_date_time() when a locale is set
- Question: ISO 8601 representations with reduced accuracy
- Unexpected error with `parse_date_time()`
- `week_start` parameter documentation HOT 1
- as_datetime() HOT 1
- Problems with POSIXct in R 4.3.2 HOT 1
- 'OO' format option not recognized for parsing ISO 8601 time zone offsets
- `parse_date_time()` cannot match missing zeroes
- Inconsistent behavior of `parse_date_time()` inside `dplyr::mutate()` HOT 2
- month() and otehrs fail on objects from class 'timeDate'
- ymd_hms() function left-pads some dates that have missing "seconds" values
- round_date in 0.1 sec doesn't work correctly
- FR: int_overlaps with exclusive endpoints
- unique() always zero for periods HOT 1
- Implement Set Operations methods for Dates
- Parsing dates with `my` seems to have a limit size
- Do we need something like `%m-%` to subtract years from leap 02/29? HOT 1
- Cannot compute `<date> + lubridate::year(1)` when `<date>` is a leap day.
- m:s:ms time data
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lubridate.