Skip to content

Commit 63d2fcf

Browse files
committed
Generate doc using rebar3_ex_doc
List of other changes: - remove trailing spaces - missing missing date to changelog - add badges for quick overview
1 parent 357b584 commit 63d2fcf

5 files changed

Lines changed: 57 additions & 29 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.sw?
44
*.iml
55
deps/
6+
doc/
67
ebin/
78
.eunit/
89
.idea/
Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
## 0.7.0
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## 0.7.0 (2021-07-01)
29

310
* Re-introduce the qdate server for storing qdate timezones, formats, and parsers,
411
rather than overloading the `application` env vars (since the `application`
512
module only wants keys to be atoms).
613
* Convert to using `qdate_localtime` 1.2.0 (which passes dialyzer checks)
714
* `qdate` is passing dialyzer again
815

9-
## 0.6.0
16+
## 0.6.0 (2021-06-01)
1017

1118
* Add `age` and `age_days` functions
1219
* Add option to preserve millisecond accuracy in date parsing and formatting (@Leonardb)
1320

1421

15-
## 0.5.0
22+
## 0.5.0 (2019-08-21)
1623

1724
* Add `range_X` functions for getting a list of dates/times within a range
1825
(such as `range_day/3` to get a range of days between a start and end date.
@@ -31,42 +38,42 @@
3138
* Fix Erlang 21 Stacktrace changes (@tnt-dev)
3239
* Set a better rebar2 version of erlware commons (@tnt-dev)
3340

34-
## 0.4.2
41+
## 0.4.2 (2015-11-05)
3542

3643
* Add partial support for `ec_date`'s 4-tuple subsecond accuracy time format.
3744
* Fix `erlware_commons` dependency to a rebar2-compatible version.
3845

39-
## 0.4.1
46+
## 0.4.1 (2015-07-26)
4047

4148
* Remove unnecessary `io:format` call.
4249

43-
## 0.4.0
50+
## 0.4.0 (2015-04-30)
4451

4552
* Remove dependency on a running server for tracking application state.
4653
Instead, parsers and formats are registered to the application environment
4754
vars (e.g. `application:get_env`), and timezones are registered to the
4855
application environment or the process dictionary. A side-effect of this
49-
change is that you can no longer query another process's timezone.
56+
change is that you can no longer query another process's timezone.
5057
* Add basic date arithmetic (e.g. `qdate:add_hours/[1-2]`, etc).
5158
* Add `get_formats()` and `get_parsers()` to see list of registered formats and
5259
parsers.
5360
* Fix bug related to relying on the application environment variable
5461
`default_timezone`
5562

56-
## 0.3.0
63+
## 0.3.0 (2014-05-11)
5764

5865
* Add Timezone/Daylight Saving Disambiguation
5966
* Add the `auto` timezone shortcut
6067
* Fix rebar.config to allow for compilation on Erlang 17
6168

62-
## 0.2.1
69+
## 0.2.1 (2013-09-23)
6370

6471
* Fix allowing timezone names to be binary
6572

66-
## 0.2.0
73+
## 0.2.0 (2013-09-12)
6774

6875
* Adding `qdate:compare/2,3` for easily comparing dates
6976

70-
## 0.1.0
77+
## 0.1.0 (2013-04-29)
7178

7279
* Initial Release

LICENSE renamed to LICENSE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# The MIT License
2+
13
Copyright (c) 2013 Jesse Gumm
24

35
Permission is hereby granted, free of charge, to any person obtaining a copy

README.markdown renamed to README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
# qdate - Erlang Date and Timezone Library
22

3-
[![Build Status](https://travis-ci.org/choptastic/qdate.png?branch=master)](https://travis-ci.org/choptastic/qdate)
3+
[![Build Status](https://img.shields.io/travis/choptastic/qdate/master.svg)](https://travis-ci.org/choptastic/qdate)
4+
[![Hex Version](https://img.shields.io/hexpm/v/qdate.svg)](https://hex.pm/packages/qdate)
5+
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/qdate/)
6+
[![Total Download](https://img.shields.io/hexpm/dt/qdate.svg)](https://hex.pm/packages/qdate)
7+
[![License](https://img.shields.io/hexpm/l/qdate.svg)](https://github.com/choptastic/qdate/blob/master/LICENSE.md)
8+
[![Last Updated](https://img.shields.io/github/last-commit/choptastic/qdate.svg)](https://github.com/choptastic/qdate/commits/master)
49

510
## Purpose
611

712
Erlang Date and Time management is rather primitive, but improving.
813

9-
[dh_date](https://github.com/daleharvey/dh_date), of which `ec_date` in
14+
[dh_date](https://github.com/daleharvey/dh_date), of which `ec_date` in
1015
[erlware_commons](https://github.com/erlware/erlware_commons) is a fork, is a
1116
huge step towards formatting and parsing dates in a way that compares nicely
12-
with PHP's [date](http://php.net/manual/en/function.date.php) and
17+
with PHP's [date](http://php.net/manual/en/function.date.php) and
1318
[strtotime](http://php.net/manual/en/function.strtotime.php) functions.
1419

15-
Unfortunately, `ec_date` doesn't deal with timezones, but conveniently,
20+
Unfortunately, `ec_date` doesn't deal with timezones, but conveniently,
1621
the project [erlang_localtime](https://github.com/dmitryme/erlang_localtime)
1722
does.
1823

@@ -92,7 +97,7 @@ two-tuple for `Date` (see "Acceptable Date formats" above).
9297
If no timezone is specified or determinable in a `Date` variable, then `qdate`
9398
will infer the timezone in the following order.
9499

95-
+ If specified by `qdate:set_timezone(Timezone)` for that process. Note, as
100+
+ If specified by `qdate:set_timezone(Timezone)` for that process. Note, as
96101
specified below (in the "Timezone Functions" section), `set_timezone/1` is
97102
a shortcut to `set_timezone(self(), Timezone)`, meaning that
98103
`set_timezone/1` only applies to that *specific* process. If none is
@@ -183,10 +188,10 @@ ok
183188

184189
#### Conversion Functions provided for API compatibility with `ec_date`
185190

186-
+ `parse/1` - Same as `to_date(Date)`
187-
+ `nparse/1` - Same as `to_now(Date)`
188-
+ `format/1` - Same as `to_string/1`
189-
+ `format/2` - Same as `to_string/2`
191+
+ `parse/1` - Same as `ec_date:to_date(Date)`
192+
+ `nparse/1` - Same as `ec_date:to_now(Date)`
193+
+ `format/1` - Same as `ec_date:to_string/1`
194+
+ `format/2` - Same as `ec_date:to_string/2`
190195

191196
### Date and Time Comparison
192197

@@ -506,7 +511,7 @@ the crash.
506511
`qdate` ships with an optional relative time parser. To speed up performance
507512
(since this parser uses regular expressions), this parser is disabled by
508513
default. But if you wish to use it, make sure you call
509-
`qdate:register_parser(parse_relative, fun qdate:parse_relative/1)`.
514+
`qdate:register_parser(parse_relative, fun qdate:parse_relative/1)`.
510515

511516
Doing this allows you to parse relative time strings of the following formats:
512517

@@ -542,7 +547,7 @@ qdate:between(qdate:add_minutes(-15), Date, qdate:add_minutes(15)).
542547
16> qdate:register_format(longdate, "l, F jS, Y g:i A T").
543548
ok
544549

545-
%% Now, let's try to format our string
550+
%% Now, let's try to format our string
546551
17> LongDateString = qdate:to_string(longdate, DateString).
547552
"Saturday, December 21st, 2013 12:24 PM GMT"
548553

@@ -568,15 +573,15 @@ Let's see how we do this
568573
"Saturday, December 21st, 2013 4:24 AM PST"
569574

570575
%% See something interesting there? Yeah, we told it it was PDT, but it output
571-
%% PST. That's because PST is not in daylight saving time in December, and
576+
%% PST. That's because PST is not in daylight saving time in December, and
572577
%% `qdate` was able to intelligently infer that, and fix it for us.
573578

574579
%% Note, that when in doubt, `qdate` will *not* convert. For example, not all
575580
%% places in Eastern Standard Time do daylight saving time, and as such, EST
576581
%% will not necessarily convert to EDT.
577582

578583
%% However, if you provide the timezone as something like "America/New York",
579-
%% it *will* figure that out, and do the correct conversion for you.
584+
%% it *will* figure that out, and do the correct conversion for you.
580585

581586
%% Let's see how it handles unix times with strings that contain timezones.
582587
%% If you recall, LongDateString = "Saturday, December 21st, 2013 12:24 PM GMT"
@@ -619,7 +624,7 @@ ok
619624
%% need to ensure that a date is presented in an appropriate timezone.
620625

621626

622-
%% Let's register some timezones by "Timezone Keys".
627+
%% Let's register some timezones by "Timezone Keys".
623628
25> qdate:set_timezone(my_site, "America/Chicago").
624629
ok
625630
26> qdate:set_timezone({user,1},"Australia/Melbourne").
@@ -713,15 +718,15 @@ midnight on the first day of the current month.
713718

714719
qdate can also do a special "beginning" case, particularly the "beginning of
715720
the week" calculation. This has three forms, specifically:
716-
721+
717722
+ `beginning_week()` - Returns first day of the current week.
718723
+ `beginning_week(Date)` - Assumes the beginning of the week is Monday
719724
(chosen because Erlang's calendar:day_of_the_week uses 1=Monday and
720725
7=Sunday).
721726
+ `beginning_week(DayOfWeek, Date)` - Calculates the beginning of the week
722727
based on the provided `DayOfWeek`. Valid values for DayOfWeek are the
723728
integers 1-7 or the atom versions of the days of the week. Specifically:
724-
729+
725730
* Monday: `1 | monday | mon`
726731
* Tuesday: `2 | tuesday | tue`
727732
* Wednesday: `3 | wednesday | wed`
@@ -880,7 +885,7 @@ not exist.
880885

881886
## Changelog
882887

883-
See [CHANGELOG.markdown](https://github.com/choptastic/qdate/blob/master/CHANGELOG.markdown)
888+
See [CHANGELOG.md](https://github.com/choptastic/qdate/blob/master/CHANGELOG.md)
884889

885890
## TODO
886891

@@ -906,4 +911,4 @@ Email: gumm@sigma-star.com
906911

907912
Twitter: [@jessegumm](http://twitter.com/jessegumm)
908913

909-
Released under the MIT License (see LICENSE file)
914+
Released under the MIT License (see [LICENSE.md](LICENSE.md) file)

rebar.config

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,16 @@
1212
erlware_commons,
1313
{qdate_localtime, "1.2.0"}
1414
]}.
15+
16+
{project_plugins, [rebar3_ex_doc]}.
17+
18+
{ex_doc, [
19+
{extras, [
20+
{"CHANGELOG.md", #{title => "Changelog"}},
21+
{"LICENSE.md", #{title => "License"}},
22+
{"README.md", #{title => "Overview"}}
23+
]},
24+
{main, "README.md"},
25+
{source_url, "https://github.com/choptastic/qdate"},
26+
{api_reference, false}
27+
]}.

0 commit comments

Comments
 (0)