fix date format to be consistent with existing posts

This commit is contained in:
Sami Samhuri 2015-05-23 23:16:03 -07:00
parent 7279f5a655
commit 289e54dc35
3 changed files with 26 additions and 13 deletions

View file

@ -18,7 +18,7 @@
"posts": [
{
"title": "→ Undocumented CoreStorage Commands",
"date": "May 24, 2015",
"date": "24th May, 2015",
"timestamp": 1432436316,
"tags": [
@ -29,7 +29,7 @@
},
{
"title": "→ Lenovo ThinkPad X1 Carbon",
"date": "May 22, 2015",
"date": "22nd May, 2015",
"timestamp": 1432254989,
"tags": [
@ -40,7 +40,7 @@
},
{
"title": "→ A bitcoin miner in every device and in every hand",
"date": "May 19, 2015",
"date": "19th May, 2015",
"timestamp": 1432004034,
"tags": [
@ -51,7 +51,7 @@
},
{
"title": "→ Constraints and Transforms in iOS 8",
"date": "May 15, 2015",
"date": "15th May, 2015",
"timestamp": 1431699995,
"tags": [
@ -62,7 +62,7 @@
},
{
"title": "→ Importing Modules in LLDB",
"date": "May 12, 2015",
"date": "12th May, 2015",
"timestamp": 1431396215,
"tags": [
@ -73,7 +73,7 @@
},
{
"title": "→ Apple Watch Human Interface Guidelines",
"date": "May 10, 2015",
"date": "10th May, 2015",
"timestamp": 1431223039,
"tags": [

View file

@ -3,7 +3,7 @@
"id": "apple-watch-human-interface-guidelines",
"author": "Sami Samhuri",
"title": "Apple Watch Human Interface Guidelines",
"date": "May 10, 2015",
"date": "10th May, 2015",
"timestamp": 1431223039,
"link": "https://developer.apple.com/watch/human-interface-guidelines/",
"url": "/posts/2015/05/apple-watch-human-interface-guidelines",
@ -15,7 +15,7 @@
"id": "importing-modules-in-lldb",
"author": "Sami Samhuri",
"title": "Importing Modules in LLDB",
"date": "May 12, 2015",
"date": "12th May, 2015",
"timestamp": 1431396215,
"link": "http://furbo.org/2015/05/11/an-import-ant-change-in-xcode/",
"url": "/posts/2015/05/importing-modules-in-lldb",
@ -27,7 +27,7 @@
"id": "constraints-and-transforms-in-ios-8",
"author": "Sami Samhuri",
"title": "Constraints and Transforms in iOS 8",
"date": "May 15, 2015",
"date": "15th May, 2015",
"timestamp": 1431699995,
"link": "http://revealapp.com/blog/constraints-and-transforms.html",
"url": "/posts/2015/05/constraints-and-transforms-in-ios-8",
@ -39,7 +39,7 @@
"id": "a-bitcoin-miner-in-every-device-and-in-every-hand",
"author": "Sami Samhuri",
"title": "A bitcoin miner in every device and in every hand",
"date": "May 19, 2015",
"date": "19th May, 2015",
"timestamp": 1432004034,
"link": "https://medium.com/@21dotco/a-bitcoin-miner-in-every-device-and-in-every-hand-e315b40f2821",
"url": "/posts/2015/05/a-bitcoin-miner-in-every-device-and-in-every-hand",
@ -51,7 +51,7 @@
"id": "lenovo-thinkpad-x1-carbon",
"author": "Sami Samhuri",
"title": "Lenovo ThinkPad X1 Carbon",
"date": "May 22, 2015",
"date": "22nd May, 2015",
"timestamp": 1432254989,
"link": "http://www.anandtech.com/show/9264/the-lenovo-thinkpad-x1-carbon-review-2015",
"url": "/posts/2015/05/lenovo-thinkpad-x1-carbon",
@ -63,7 +63,7 @@
"id": "undocumented-corestorage-commands",
"author": "Sami Samhuri",
"title": "Undocumented CoreStorage Commands",
"date": "May 24, 2015",
"date": "24th May, 2015",
"timestamp": 1432436316,
"link": "http://blog.fosketts.net/2011/08/05/undocumented-corestorage-commands/",
"url": "/posts/2015/05/undocumented-corestorage-commands",

View file

@ -96,7 +96,20 @@ class HarpBlog
end
def date
@date ||= time.strftime('%B %-d, %Y')
@date ||= time.strftime("#{ordinalize(time.day)} %B, %Y")
end
def ordinalize(n)
case
when n % 10 == 1 && n != 11
"#{n}st"
when n % 10 == 2 && n != 12
"#{n}nd"
when n % 10 == 3 && n != 13
"#{n}rd"
else
"#{n}th"
end
end
def tags