<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yuta-nakata</author_name>
  <author_url>https://blog.hatena.ne.jp/yuta-nakata/</author_url>
  <blog_title>Yuta NakataのBlog</blog_title>
  <blog_url>https://www.yuta-nakata.net/</blog_url>
  <categories>
    <anon>Python</anon>
  </categories>
  <description>うるう年がらみの日付計算は、自前で書くとどこかで必ず踏み抜きます。この記事では標準ライブラリの calendar に任せる基本に加えて、「1年後」「月末」「うるう日生まれの年齢」という実務で刺されやすい落とし穴を、実行結果付きで整理します。 サマリー うるう年の定義 そもそもうるう年とは？ 定義 うるう年の計算をしてみる 自前でコードを書いた場合 標準ライブラリを使った場合 本当に怖いのは「判定」ではなく「その後の計算」 落とし穴1:「1年後」を365日で計算する 落とし穴2:月末の日数をハードコードする 落とし穴3:うるう日生まれの年齢計算 calendar と dateutil の使い分け…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.yuta-nakata.net%2Fentry%2F2024%2F07%2F05%2F190118&quot; title=&quot;うるう年の計算はPythonに任せよう - Yuta NakataのBlog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn.image.st-hatena.com/image/square/23ff597bd045490499b097f036afb3ec0665a0d5/backend=imagemagick;height=80;version=1;width=80/https%3A%2F%2Fcdn.user.blog.st-hatena.com%2Fcircle_image%2F88409737%2F1514352962196085</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2024-07-05 19:01:18</published>
  <title>うるう年の計算はPythonに任せよう</title>
  <type>rich</type>
  <url>https://www.yuta-nakata.net/entry/2024/07/05/190118</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
