Closed debajit closed 11 years ago
You need to set the timezone in your config.rb. For example:
Time.zone = "US/Eastern"
This happens because Middleman assumes UTC by default, which is not the case if you're on Windows or something else using localtime.
In my config.rb, I have:
Time.zone = "America/Los_Angeles"
(I am on OS X Mountain Lion)
Well, that was my best guess. Maybe since the offset in your frontmatter is set for UTC (+00:00) it's causing a problem? You could try setting the timezone to UTC or removing the timezone if all of your articles are set for +00:00.
Sorry this is kind of a shot in the dark. Maybe one of the devs can help.
Yes, removing the time part of the date-time string is a workaround (so I'm not stuck or anything).
The issue that I wanted to point out here is that "middleman article
Understood.
The timestamp isn't even mandatory - it's just in the template so people know they can include it if they want multiple posts from the same day to sort correctly. We should figure out how to generate that timestamp in the specified time zone...
OK, I've fixed it to generate the timestamp in the right time zone.
Hello,
I am moving from Octopress to Middleman. I made a quick script to fix the dates and worked fine for me:
require 'fileutils'
require 'time'
files = Dir.glob("*.markdown")
puts "Processing #{files.count} files"
files.each do |f|
list = []
list << f
File.readlines(f).each do |line|
if line.include?("date: ")
string = line[6,19]
string.include?("\n") ? s = string.strip : s = string
time = Time.parse(string)
FileUtils.touch f, mtime: time
end
end
end
puts "Finished!"
Best regards
UPDATE: Apparently it works for SOME posts but not for others. I can't tell why though.
Steps to Reproduce: • Create a blog article using "middleman article title" • Run middleman build
Expected Results: The build should not fail.
Actual Results: The build fails.
Notes: This is because the markdown filename contains only the date, whereas the frontmatter contains the time as well. date: 2006-06-10 00:00 +00:00