jupyter / jupyter/notebook

International dates in Jupyter savewidget

Open
#693 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

The code in notebook/static/edit/js/savewidget.js uses the `moment.js` javascript library which, unfortunately, uses locales to display dates. The problem is that the default locale is the US one, which is very confusing if you are not used to it (months/days are switched, days starts at 12, 12 pm does not follow 11 pm, etc...).

Here is the javascript code to make Jupyter display dates and time following the [ISO8601 international date/time format](https://en.wikipedia.org/wiki/ISO_8601).

``` javascript
moment.locale('en', {
longDateFormat : {
LT : 'HH:mm',
LTS : 'HH:mm:ss',
L : 'YYYY-MM-DD',
LL : 'D MMMM YYYY',
LLL : 'D MMMM YYYY HH:mm',
LLLL : 'dddd, D MMMM YYYY HH:mm'
},
week : {
dow : 1, // Monday is the first day of the week.
doy : 4 // The week that contains Jan 4th is the first week of the year.
}
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.