Skip to content

Commit

Permalink
fix calendar issue (#16)
Browse files Browse the repository at this point in the history
* fix calendar issue

* strftime fixes

* documentation updates

* support current date marking in calendar for linux system only

* documentation updates

* minor fixes
  • Loading branch information
amitgaru2 authored Dec 28, 2020
1 parent 939f141 commit 6ad0b6b
Show file tree
Hide file tree
Showing 21 changed files with 127 additions and 305 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ The `Python3` core [``datetime``](https://docs.python.org/3.5/library/datetime.h
>>> datetime.datetime(2020, 9, 4, 8, 26, 10, 123456).strftime("%d %B %Y") # 04 September 2020
>>> nepali_datetime.datetime(2077, 5, 19, 8, 26, 10, 123456).strftime("%d %B %Y") # 19 Bhadau 2077

# datetime parsed from string (strptime)
>>> datetime.datetime.strptime('2020-12-27', '%Y-%m-%d') # datetime.datetime(2020, 12, 27, 0, 0)
>>> nepali_datetime.datetime.strptime('2077-09-12', '%Y-%m-%d') # nepali_datetime.datetime(2077, 9, 12, 0, 0)

# date/datetime formatting with Nepali month unicode support
>>> nepali_datetime.date(2078, 1, 10).strftime('%N') # वैशाख

Expand Down
Binary file modified docs/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/doctrees/index.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: b39ba45a6a846c746d9b570ff4d2438a
config: 8f8382e665615fe17d8e673a1fc883d8
tags: 645f666f9bcd5a90fca523b33c5a78b7
68 changes: 2 additions & 66 deletions docs/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,6 @@ Example of working with :class:`date`:
>>> d = nepali_datetime.date.fromordinal(10000) # 10000th day after 1. 1. 1975
>>> d
nepali_datetime.date(2002, 5, 12)
>>> t = d.timetuple()
>>> for i in t: # doctest: +SKIP
... print(i)
2002 # year
5 # month
12 # day
0
0
0
2 # weekday (2 = Tuesday)
138 # 138th day in the year
-1
>>> d.isoformat()
'2002-05-12'
>>> d.strftime("%d/%m/%y")
Expand Down Expand Up @@ -581,35 +569,20 @@ Examples of working with datetime objects:
.. doctest::

>>> import nepali_datetime
>>> from datetime import time
>>> # Using datetime.combine()
>>> d = nepali_datetime.date(2005, 7, 14)
>>> t = time(12, 30)
>>> nepali_datetime.datetime.combine(d, t)
nepali_datetime.datetime(2005, 7, 14, 12, 30)
>>> # Using nepali_datetime.datetime.now() or nepali_datetime.datetime.utcnow()
>>> nepali_datetime.datetime.now() # doctest: +SKIP
nepali_datetime.datetime(2007, 12, 6, 16, 29, 43, 79043) # GMT +1
nepali_datetime.datetime(2007, 12, 6, 16, 30, 43, 79043) # GMT +5:45
>>> nepali_datetime.datetime.utcnow() # doctest: +SKIP
nepali_datetime.datetime(2007, 12, 6, 15, 29, 43, 79060)
nepali_datetime.datetime(2007, 12, 6, 10, 45, 43, 79060)
>>> # Using nepali_datetime.datetime.strptime()
>>> dt = nepali_datetime.datetime.strptime("21/11/06 16:30", "%d/%m/%y %H:%M")
>>> dt
nepali_datetime.datetime(2006, 11, 21, 16, 30)
>>> # Using nepali_datetime.datetime.timetuple() to get tuple of all attributes
>>> tt = dt.timetuple()
>>> for it in tt: # doctest: +SKIP
... print(it)
...
2006 # year
11 # month
21 # day
16 # hour
30 # minute
0 # second
6 # weekday (0 = Sunday)
325 # number of days since 1st January
-1 # dst - method tzinfo.dst() returned None
>>> # Formatting datetime
>>> dt.strftime("%A, %d. %B %Y %I:%M%p")
'Saturday, 21. Falgun 2006 04:30PM'
Expand Down Expand Up @@ -715,38 +688,6 @@ Directives Meaning Example Notes
``%Z`` Time zone name (empty string (empty), UTC, EST, CST
if the object is naive).

``%j`` Day of the year as a 001, 002, ..., 366
zero-padded decimal number.

``%U`` Week number of the year 00, 01, ..., 53 \(7)
(Sunday as the first day of
the week) as a zero padded
decimal number. All days in a
new year preceding the first
Sunday are considered to be in
week 0.

``%W`` Week number of the year 00, 01, ..., 53 \(7)
(Monday as the first day of
the week) as a decimal number.
All days in a new year
preceding the first Monday
are considered to be in
week 0.

``%c`` Locale's appropriate date and Tue Asa 16 21:30:00 \(1)
time representation. 1988



``%x`` Locale's appropriate date 08/16/88 (None); \(1)
representation. 08/16/1988


``%X`` Locale's appropriate time 21:30:00 \(1)
representation.

``%%`` A literal ``'%'`` character. %
=========== ================================ ======================== =======


Expand Down Expand Up @@ -797,11 +738,6 @@ Notes:
string. Otherwise ``%Z`` is replaced by the returned value, which must
be a string.

.. versionchanged:: 3.2
When the ``%z`` directive is provided to the :meth:`strptime` method, an
aware :class:`.datetime` object will be produced. The ``tzinfo`` of the
result will be set to a :class:`timezone` instance.

(7)
When used with the :meth:`strptime` method, ``%U`` and ``%W`` are only used
in calculations when the day of the week and the year are specified.
1 change: 1 addition & 0 deletions docs/html/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,7 @@ div.code-block-caption code {
}

table.highlighttable td.linenos,
span.linenos,
div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
user-select: none;
}
Expand Down
4 changes: 2 additions & 2 deletions docs/html/_static/classic.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ p.admonition-title:after {

pre {
padding: 5px;
background-color: unset;
color: unset;
background-color: #eeffcc;
color: #333333;
line-height: 120%;
border: 1px solid #ac9;
border-left: none;
Expand Down
5 changes: 3 additions & 2 deletions docs/html/_static/doctools.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,10 @@ var Documentation = {
initOnKeyListeners: function() {
$(document).keydown(function(event) {
var activeElementType = document.activeElement.tagName;
// don't navigate when in search box or textarea
// don't navigate when in search box, textarea, dropdown or button
if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
&& !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
&& activeElementType !== 'BUTTON' && !event.altKey && !event.ctrlKey && !event.metaKey
&& !event.shiftKey) {
switch (event.keyCode) {
case 37: // left
var prevHref = $('link[rel="prev"]').prop('href');
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.0.4',
VERSION: '1.0.5',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
10 changes: 5 additions & 5 deletions docs/html/_static/pygments.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
pre { line-height: 125%; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #eeffcc; }
.highlight .c { color: #408090; font-style: italic } /* Comment */
Expand Down
8 changes: 4 additions & 4 deletions docs/html/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ var Search = {
_pulse_status : -1,

htmlToText : function(htmlString) {
var htmlElement = document.createElement('span');
htmlElement.innerHTML = htmlString;
$(htmlElement).find('.headerlink').remove();
docContent = $(htmlElement).find('[role=main]')[0];
var virtualDocument = document.implementation.createHTMLDocument('virtual');
var htmlElement = $(htmlString, virtualDocument);
htmlElement.find('.headerlink').remove();
docContent = htmlElement.find('[role=main]')[0];
if(docContent === undefined) {
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
Expand Down
19 changes: 12 additions & 7 deletions docs/html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Index &#8212; nepali_datetime 1.0.4 documentation</title>
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" />
<title>Index &#8212; nepali_datetime 1.0.5 documentation</title>
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/pydoctheme.css" type="text/css" />

<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>

<link rel="index" title="Index" href="#" />
<link rel="search" title="Search" href="search.html" />
Expand All @@ -37,7 +36,7 @@ <h3>Navigation</h3>
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>

<a href="index.html">nepali_datetime 1.0.4 documentation</a> &#187;
<a href="index.html">nepali_datetime 1.0.5 documentation</a> &#187;


<li class="nav-item nav-item-this"><a href="">Index</a></li>
Expand Down Expand Up @@ -363,7 +362,7 @@ <h3>Navigation</h3>
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://www.python.org/">Python</a> &#187;</li>

<a href="index.html">nepali_datetime 1.0.4 documentation</a> &#187;
<a href="index.html">nepali_datetime 1.0.5 documentation</a> &#187;


<li class="nav-item nav-item-this"><a href="">Index</a></li>
Expand All @@ -385,8 +384,14 @@ <h3>Navigation</h3>
</ul>
</div>
<div class="footer">
&copy; <a href="copyright.html">Copyright</a> 2020, Amit Garu.
&copy; <a href="copyright.html">Copyright</a> 2021, Amit Garu.
<br />
This page is licensed under the Python Software Foundation License Version 2.
<br />
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
<br />
See <a href="">History and License</a> for more information.
<br /><br />

The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
Expand All @@ -397,7 +402,7 @@ <h3>Navigation</h3>

<br />

Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.4.1.
</div>

</body>
Expand Down
Loading

0 comments on commit 6ad0b6b

Please sign in to comment.