|
1 | | -# holocene |
| 1 | +# hedate |
2 | 2 |
|
3 | | -Takes advantage of the `chrono` crate to provide a GNU `date` like interface for convert dates to the Holocene calendar. |
| 3 | +`hedate` is a Holocene/Human Era-aware (_GNU_) `date`-like utility for |
| 4 | +converting, formatting, and expressing dates in the Holocene/Human Era calendar |
| 5 | +system. |
4 | 6 |
|
5 | | -## Known issues |
| 7 | +> What is the Holocene calendar? |
| 8 | +> |
| 9 | +> https://en.wikipedia.org/wiki/Holocene_calendar |
| 10 | +> |
| 11 | +> According to Wikipedia: "The Holocene calendar, also known as the Holocene Era |
| 12 | +> or Human Era (HE), is a year numbering system that adds exactly 10,000 years |
| 13 | +> to the currently dominant (AD/BC or CE/BCE) numbering scheme, placing its |
| 14 | +> first year near the beginning of the Holocene geological epoch and the |
| 15 | +> Neolithic Revolution, when humans shifted from a hunter-gatherer lifestyle to |
| 16 | +> agriculture and fixed settlements." |
6 | 17 |
|
7 | | -* Timezone support is not implemented yet. UTC is assumed. |
8 | | -* Years must be zero padded to 4 digits. E.g. `0001` instead of `1`. |
| 18 | +The Holocene/Human Era calendar is a way to date the full span of human history |
| 19 | +by counting years from the beginning of the Holocenem, which marks the start of |
| 20 | +settled human civilization. It helps simplify mental models of human history. |
9 | 21 |
|
10 | | -## Example usage |
| 22 | +Date examples: |
| 23 | + |
| 24 | +| Event | Human Era Date | Gregorian Date | |
| 25 | +| -------------------------- | --------------- | -------------- | |
| 26 | +| Start of Holocene Era | 0 HE | 10 000 BCE | |
| 27 | +| Founding of Athens | 9492 HE | 508 BCE | |
| 28 | +| Founding of Rome | 9247 HE | 753 BCE | |
| 29 | +| Conquest of Constantinople | 29 May 11453 HE | 29 May 1453 CE | |
| 30 | +| Unix Epoch | 1 Jan 11970 HE | 1 Jan 1970 CE | |
| 31 | +| Present year | 12025 HE | 2025 CE | |
| 32 | + |
| 33 | +Weekdays follow the proleptic Gregorian weekday cycle for all dates, both |
| 34 | +backward and forward in time. |
| 35 | + |
| 36 | +## Usage |
| 37 | + |
| 38 | +`hedate --help` |
| 39 | + |
| 40 | +``` |
| 41 | +Holocene/Human Era date command |
| 42 | +
|
| 43 | +Usage: hedate [OPTIONS] [format]... |
| 44 | +
|
| 45 | +Arguments: |
| 46 | + [format]... Format string (prefix with +) |
| 47 | +
|
| 48 | +Options: |
| 49 | + -d, --date <STRING> Date string |
| 50 | + --help Print help information |
| 51 | + -u, --utc Use Coordinated Universal Time |
| 52 | + -z, --timezone <OFFSET|TZ> Set timezone offset (e.g., -08:00, +05:30, 08:00) or common abbrev (PST, EST) |
| 53 | + --rfc-2822 Output date and time in RFC 2822 format |
| 54 | + --rfc-email Output date and time in RFC 5322 format (alias for --rfc-2822) |
| 55 | + --rfc-3339 [<TIMESPEC>] Output date and time in RFC 3339 format (TIMESPEC: date, seconds, ns) [possible values: date, seconds, ns] |
| 56 | + -I, --iso-8601 [<FMT>] Output date/time in ISO 8601 format (FMT: date, hours, minutes, seconds, ns) [possible values: date, hours, minutes, seconds, ns] |
| 57 | + -g, --gregorian Explicitly interpret -d/--date as Gregorian/CE |
| 58 | + -h, --holocene Explicitly interpret -d/--date as Holocene/Human Era |
| 59 | + -f, --file <DATEFILE> Read dates to parse from file, one per line |
| 60 | + --debug Annotate parsed date and warn about questionable usage |
| 61 | + --resolution Output available timestamp resolution |
| 62 | + -V, --version Print version |
| 63 | +
|
| 64 | +Format presets: |
| 65 | + --rfc-2822 / --rfc-email RFC 2822/5322 |
| 66 | + --rfc-3339[=date|seconds|ns] |
| 67 | + --iso-8601[=date|hours|minutes|seconds|ns] |
| 68 | +
|
| 69 | +Formatting tokens (Holocene-aware replacements): |
| 70 | + %Y/%y/%C Holocene years (year+10000) |
| 71 | + %E Era marker: HE |
| 72 | + %s Seconds since Holocene epoch (-9999-01-01T00:00:00Z) |
| 73 | + %N/%<n>N Nanoseconds since Holocene epoch (n = digits precision) |
| 74 | + %Z Timezone abbreviation |
| 75 | +Other tokens are passed to chrono/strftime. Relative inputs like "+1 day" are supported. |
| 76 | +
|
| 77 | +Weekdays follow the proleptic Gregorian weekday cycle for all dates, both backward and forward in time. |
| 78 | +``` |
| 79 | + |
| 80 | +## Examples |
| 81 | + |
| 82 | +**Current time (local tz)** |
| 83 | + |
| 84 | +```shell |
| 85 | +hedate |
| 86 | +``` |
| 87 | + |
| 88 | +**Current time UTC** |
| 89 | + |
| 90 | +```shell |
| 91 | +hedate --utc |
| 92 | +``` |
| 93 | + |
| 94 | +(alias `--universal`, `-u`) |
| 95 | + |
| 96 | +**Custom timezone** |
| 97 | + |
| 98 | +```shell |
| 99 | +hedate -z -08:00 |
| 100 | +``` |
| 101 | + |
| 102 | +Supports offsets like `+05:30`, `08:00`, `-06:00`, common abbreviations: |
| 103 | +`PST`/`MST`/`CST`/`EST`/`BST`/`CET`/`EET`/`IST`/`UTC`/`GMT`, and IANA names such |
| 104 | +as `America/Los_Angeles` and `Europe/London` |
| 105 | + |
| 106 | +**Specific date/time** |
11 | 107 |
|
12 | | -View the built-in help message. |
13 | 108 | ```shell |
14 | | -holocene --help |
| 109 | +hedate -d "1970/12/31 23:59:59" |
15 | 110 | ``` |
16 | 111 |
|
17 | | -Get the current holocene date and time (UTC.) |
| 112 | +**Holocene input** |
| 113 | + |
18 | 114 | ```shell |
19 | | -holocene |
| 115 | +hedate -h -d "0337/12/31 12:01:57" |
20 | 116 | ``` |
21 | 117 |
|
22 | | -Get the current holocene date and time (UTC) with custom formatting. |
| 118 | +or suffix: `-d "0337/12/31 12:01:57 HE"` |
| 119 | + |
| 120 | +**BCE input** |
| 121 | + |
23 | 122 | ```shell |
24 | | -holocene "+%m-%d-%Y %H:%M:%S %z %Z %E" |
| 123 | +hedate -d "0337/12/31 BCE" |
25 | 124 | ``` |
26 | 125 |
|
27 | | -Get the holocene date for a specific date. |
| 126 | +**Custom format** |
| 127 | + |
28 | 128 | ```shell |
29 | | -holocene -d "12/31/1970" |
| 129 | +hedate "+%m-%d-%Y %H:%M:%S %z %Z %E" |
30 | 130 | ``` |
| 131 | + |
| 132 | +**RFC/ISO presets** |
| 133 | + |
31 | 134 | ```shell |
32 | | -holocene -d "1970/12/31" |
| 135 | +hedate --rfc-3339 |
33 | 136 | ``` |
34 | 137 |
|
35 | | -Get the holocene date for a specific date and time (UTC.) |
| 138 | +`--rfc-2822`, `--rfc-email`, `--rfc-3339[=date|seconds|ns]`, |
| 139 | +`--iso-8601[=date|hours|minutes|seconds|ns]` |
| 140 | + |
| 141 | +**Relative** |
| 142 | + |
36 | 143 | ```shell |
37 | | -holocene -d "12/31/1970 23:59:59" |
| 144 | +hedate -d "+1 day"`, `hedate -d "last week"`, `hedate -d "tomorrow" |
38 | 145 | ``` |
| 146 | + |
| 147 | +**File input** |
| 148 | + |
39 | 149 | ```shell |
40 | | -holocene -d "1970/12/31 23:59:59" |
| 150 | +hedate -f dates.txt |
41 | 151 | ``` |
42 | 152 |
|
43 | | -Get a holocene date for a specific BCE date. |
| 153 | +**Resolution** |
| 154 | + |
44 | 155 | ```shell |
45 | | -holocene -d "12/31/0337 BCE" |
| 156 | +hedate --resolution |
46 | 157 | ``` |
47 | 158 |
|
| 159 | +**Debug parsing** |
| 160 | + |
48 | 161 | ```shell |
49 | | -holocene -d "0337/12/31 12:01:57 BCE" |
| 162 | +hedate --debug -d "12/31/1970" |
50 | 163 | ``` |
51 | 164 |
|
52 | | -Get the holocene date for a specific date and time (UTC) with custom formatting. |
| 165 | +## Real World Examples |
| 166 | + |
| 167 | +**Get the founding of Rome in the Human Era** |
| 168 | + |
53 | 169 | ```shell |
54 | | -holocene -d "12/31/1970 23:59:59" "+%m-%d-%Y %H:%M:%S %z %Z %E" |
55 | | -``` |
| 170 | +hedate -d "0753/04/21 BCE" # yyyy/mm/dd |
| 171 | +hedate -d "04/21/0753 BCE" # mm/dd/yyyy |
| 172 | +``` |
| 173 | + |
| 174 | +**Use the Human Era as a timestamp** |
| 175 | + |
| 176 | +```shell |
| 177 | +hedate +%s # seconds |
| 178 | +hedate +%s%3N # miliseconds |
| 179 | +hedate +%s%N # nanoseconds |
| 180 | +``` |
| 181 | + |
| 182 | +## Behavior |
| 183 | + |
| 184 | +- Calendars: auto-detect `-d` inputs (Gregorian, BCE/BC, Holocene with |
| 185 | + `HE`/`human`); force with `-g/--gregorian` or `-h/--holocene/--human`. |
| 186 | +- Timezone: local by default; `--utc/--universal/-u` for UTC; custom offsets |
| 187 | + with `-z/--timezone/--tz` (e.g., `-08:00`, `+05:30`, `08:00`) plus a few |
| 188 | + common abbreviations |
| 189 | + (`PST`/`MST`/`CST`/`EST`/`BST`/`CET`/`EET`/`IST`/`UTC`/`GMT`). |
| 190 | +- Holocene conversion: uses proleptic Gregorian with astronomical year numbering |
| 191 | + (year 0 exists); Holocene year = astronomical year + 10,000. |
| 192 | +- Epoch-based formatters: `%s`/`%N` report seconds/nanoseconds since the |
| 193 | + Holocene epoch (10,000 BCE start), not Unix epoch. |
| 194 | +- Era/year replacements: `%Y/%y/%C` emit Holocene year values; `%E` emits `HE`; |
| 195 | + `%Z` uses tz abbreviation. |
| 196 | +- Other format tokens are passed through to chrono/strftime; padding flags are |
| 197 | + handled by chrono when not overridden. |
| 198 | + |
| 199 | +## Building |
| 200 | + |
| 201 | +```shell |
| 202 | +cargo build --release |
| 203 | +``` |
| 204 | + |
| 205 | +## Testing |
| 206 | + |
| 207 | +```shell |
| 208 | +cargo test |
| 209 | +``` |
0 commit comments