billimarie / prosecutor-database

An open-source, community oversight dataset of all U.S. Prosecutors. Happy Hacktoberfest 🎃
https://billimarie.github.io/prosecutor-database
Other
87 stars 85 forks source link

[CODE] Convert date format #13

Closed billimarie closed 6 years ago

billimarie commented 7 years ago

re: appointed date (see US Attorneys)

Convert .json dates to human-friendly month day, year format (conversely: change .json dates to human-friendly format. potential issue: organization)

M-ZubairAhmed commented 7 years ago

Is this done ? because i can see in the website dates are properly there? or am i looking at the wrong section image

Also could you tell me in which format do you have in your database? so i can convert it properly

billimarie commented 7 years ago

Hi @M-ZubairAhmed, thanks for checking it out.

Each attorney entry in the database is formatted in JSON:

{
    "_id": {
        "$oid": "5919ed1c734d1d1cd0be9d88"
    },
    "attorney-id": "ua-al-m",
    "name": "A. Clark Morris",
    "role": "U.S. Attorney",
    "state": "Alabama",
    "district": "Middle District of Alabama",
    "appointed": "2017-03-11"
}

As you'll notice, the "appointed date" is just a string. Hopefully this can be changed so that in the future, a user will be able to use the app to filter through dates. If you have an idea of how to do this, please feel free to submit a pull request.

callan-stretton commented 6 years ago

I'll see if I can figure it out...

pidddgy commented 6 years ago

Hey, i'd be interested in doing this. Where is the json located?

Thai56 commented 6 years ago

In api/data/usAttorneys.js I changed the "appointed" date to be a unix time stamp so that it would be easier to sort. In client/templates/sections/current-prosecutors.html I updated the appointed section to display month-day-year. When I open up localhost:3000 I am not able to see anything.

billimarie commented 6 years ago

Thanks for the assistance, everyone. Closing out thanks to @Thai56's pull-request: #31