Skip to content

emrysr/rickdate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RickDate

Python package to display full date as 3 characters. like this: 57e (2021-07-14)

It just encodes the 3 parts (year, month and day) as base36 strings.
The output is only 3 characters long:- "Y-M-D"

Represents the date as a RickDate string.

Use case A:

I use it to date my timesheets eg: 574.txt

Use case B:

I use it to datestamp file uploads... eg: 574_filename.png

Use case C:

I use it to date script versions... eg: 574_file_scripts.sh

Comparison of other date formats:

Which column of files is nicer to read?:

RickDate NICE long/non-sortable NOT NICE
574_filename.png 4_July_2021_filename.png
575_filename.png 20210705_filename.png
576_filename.png 06_07_2021_filename.png
584_filename.png 4_August_2021_filename.png
594_filename.png 04_September_2021_filename.png
674_filename.png July_04_2022_filename.png
774_filename.png 4_July_2022_filename.png
774_filename.png 2022-07-04_filename.png*

Examples of different dates

Here are examples of how a RickDate would changes over time:

Change of years year
4th of July 2021 574
4th of July 2022 674
4th of June 2023 774
Change of months month
4th of July 2021 574
4th of Aug 2021 584
4th of Sept 2021 594
Change of days day
4th of July 2021 574
5th of July 2021 575
6th of July 2021 576

Usage

import rickdate
print(rickdate())

If the current date was the 12th August 2021 then the output should be "58C"

Base36

"Any number larger than nine gets a letter of the alphabet..."

part range
day (1-31) 1,2,3,4,5,....9,A,B,C...T,U,V
month(1-12) 1,2,3,4,5,6,7,8,9,A,B,C
year(eg 2021) 1K5,1K6,1K7... last digit repeats every 36 years

You can test the number base conversion with this tool:
http://extraconversion.com/base-number/base-36

I have also made a tool in javascript (on codepen) to convert to and from RickDate

The results are sortable alphabetically (and by date)

Limitations

I only use the last digit of the year as I'll be to busy in my flying car in 36 years to care about repeats!

Use the full 3 digit year if you see the use of this being a problem

print(rickdate.withFullYear())

The output of this should look like: "1k579" for the 9th July 2021

Build

python3 -m build

Distribute on PyPi

python3 -m twine upload --repository testpypi dist/*

future changes (once re-built)

python3 -m twine upload --skip-existing --repository testpypi dist/*

last updated: 57E

todo:

  • create readme
  • output 3 letter rickdate
  • submit package to pypi
  • output full year
  • accept date object input
  • accept iso3601 dates string input

About

format date as 3 characters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages