html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/4337#issuecomment-674394720,https://api.github.com/repos/pydata/xarray/issues/4337,674394720,MDEyOklzc3VlQ29tbWVudDY3NDM5NDcyMA==,6628425,2020-08-15T13:10:28Z,2020-08-15T13:10:28Z,MEMBER,"> It would be good if xarray.cftime_range supported the default strftime format output from cftime.datetime objects. It is confusing that it uses this format with repr but explicitly does not support it.
@aidanheerdegen see #4343 for a PR that enables this.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,677307460
https://github.com/pydata/xarray/issues/4337#issuecomment-674008512,https://api.github.com/repos/pydata/xarray/issues/4337,674008512,MDEyOklzc3VlQ29tbWVudDY3NDAwODUxMg==,6628425,2020-08-14T10:29:05Z,2020-08-14T10:29:05Z,MEMBER,"> Turns zero-padding years is platform dependent.
Oh wow, I didn't appreciate this; thanks for digging that up.
> Thanks for being open to supporting the default output. My only goal is to remove barriers to productivity and remove sources of confusion as I want these tools to be used, and embraced, as widely as possible.
For sure! I can work on a PR for that.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,677307460
https://github.com/pydata/xarray/issues/4337#issuecomment-673840314,https://api.github.com/repos/pydata/xarray/issues/4337,673840314,MDEyOklzc3VlQ29tbWVudDY3Mzg0MDMxNA==,6063709,2020-08-14T01:56:49Z,2020-08-14T01:56:49Z,CONTRIBUTOR,"Turns zero-padding years is platform dependent.
https://bugs.python.org/issue13305","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,677307460
https://github.com/pydata/xarray/issues/4337#issuecomment-673769082,https://api.github.com/repos/pydata/xarray/issues/4337,673769082,MDEyOklzc3VlQ29tbWVudDY3Mzc2OTA4Mg==,6063709,2020-08-14T00:08:22Z,2020-08-14T00:08:22Z,CONTRIBUTOR,"Thanks for the detailed response @spencerkclark
Seems that we're using different versions of `python` as my `datetime` implementation doesn't produce a zero padded year. I guess that was a bug that has also been fixed:
```python
In [1]: import datetime
In [2]: datetime.datetime(1, 1, 1).strftime(""%Y-%m-%dT%H:%M:%S"")
Out[2]: '1-01-01T00:00:00'
```
I agree that the `isoformat` is a good solution. I didn't know it was available in newer versions. I will upgrade my `cftime` version to `>=1.1.3` to access it.
Thanks for being open to supporting the default output. My only goal is to remove barriers to productivity and remove sources of confusion as I want these tools to be used, and embraced, as widely as possible.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,677307460
https://github.com/pydata/xarray/issues/4337#issuecomment-672825107,https://api.github.com/repos/pydata/xarray/issues/4337,672825107,MDEyOklzc3VlQ29tbWVudDY3MjgyNTEwNw==,6628425,2020-08-12T11:52:13Z,2020-08-12T11:52:13Z,MEMBER,"Thanks @aidanheerdegen, at least part of this issue may be better discussed in the cftime repository. This seems like a cftime bug:
```
In [1]: import cftime
In [2]: cftime.datetime(1, 1, 1).strftime(""%Y-%m-%dT%H:%M:%S"")
Out[2]: ' 1-01-01T00:00:00'
```
Following Python standard library conventions for `strftime`, the year should be zero-padded:
```
In [3] import datetime
In [4]: datetime.datetime(1, 1, 1).strftime(""%Y-%m-%dT%H:%M:%S"")
Out[4]: '0001-01-01T00:00:00'
```
ISO-8601 formatting [requires zero-padding for years < 1000](https://en.wikipedia.org/wiki/ISO_8601#Years), which due to the bug above cannot currently be achieved easily with `strftime`. Note you may find the `isoformat` method of `cftime.datetime` objects helpful, which already works as we would like it to:
```
In [5]: cftime.datetime(1, 1, 1).isoformat()
Out[5]: '0001-01-01T00:00:00'
```
As for your suggested solution:
> It would be good if `xarray.cftime_range` supported the default `strftime` format output from `cftime.datetime` objects. It is confusing that it uses this format with `repr` but explicitly does not support it.
I'm open to this. It seems reasonable that we could expand the acceptable time formats to include the default string representation of cftime objects (the only difference is a [`"" ""` datetime separator instead of `""T""`](https://github.com/pydata/xarray/blob/7daad4fce3bf8ad9b9bc8e7baa104c476437e68d/xarray/coding/cftimeindex.py#L76-L89)).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,677307460