<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:idx="urn:atom-extension:indexing" xmlns="http://www.w3.org/2005/Atom" xmlns:dw="https://www.dreamwidth.org" idx:index="no">
  <id>tag:dreamwidth.org,2009-04-14:58489</id>
  <title>Monica</title>
  <subtitle>Monica</subtitle>
  <author>
    <name>Monica</name>
  </author>
  <link rel="alternate" type="text/html" href="https://cellio.dreamwidth.org/"/>
  <link rel="self" type="text/xml" href="https://cellio.dreamwidth.org/data/atom"/>
  <updated>2025-02-07T21:40:53Z</updated>
  <dw:journal username="cellio" type="personal"/>
  <entry>
    <id>tag:dreamwidth.org,2009-04-14:58489:2142176</id>
    <link rel="alternate" type="text/html" href="https://cellio.dreamwidth.org/2142176.html"/>
    <link rel="self" type="text/xml" href="https://cellio.dreamwidth.org/data/atom/?itemid=2142176"/>
    <title>learning curve</title>
    <published>2025-02-07T21:40:53Z</published>
    <updated>2025-02-07T21:40:53Z</updated>
    <category term="codidact"/>
    <category term="programming"/>
    <dw:security>public</dw:security>
    <dw:reply-count>4</dw:reply-count>
    <content type="html">&lt;p&gt;In the past couple of weeks I have learned how to do some new-to-me things in Ruby on Rails.  I learned how to write a database migration (that is, a schema change for a deployed system), and then a &lt;em&gt;data&lt;/em&gt; migration, and I wrote my first tiny little model (in the model-view-controller sense), and this week I learned how to write a unit test.  There has been a lot of searching and hair-pulling (how the heck do you do &lt;em&gt;this&lt;/em&gt; in this language?), but it's also kind of gratifying to have what is my most complicated pull request so far under review.  I feel like I can maybe do more than make the super-easy changes (when I'm not convinced that I'll never learn Rails and I'm doomed).  Overall, pretty neat.&lt;/p&gt;
&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=cellio&amp;ditemid=2142176" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
  <entry>
    <id>tag:dreamwidth.org,2009-04-14:58489:2099761</id>
    <link rel="alternate" type="text/html" href="https://cellio.dreamwidth.org/2099761.html"/>
    <link rel="self" type="text/xml" href="https://cellio.dreamwidth.org/data/atom/?itemid=2099761"/>
    <title>Oh for crying out loud (thank you Javascript!)</title>
    <published>2021-06-02T02:33:45Z</published>
    <updated>2021-06-02T02:34:30Z</updated>
    <category term="programming"/>
    <dw:security>public</dw:security>
    <dw:reply-count>1</dw:reply-count>
    <content type="html">&lt;p&gt;We have a widget on our site that displays the current Hebrew date.  We're using HebCal's REST API to get the data, which comes back a month at a time -- JSON blob that has one entry for each day, with the secular date, the Hebrew date, and some other information.  We use the Javascript Date class to get today's date, extract a string of the right format from that, and look up "today" in that returned collection.  Easy, right?  The API documentation for Date makes a point of saying that it uses local time, not UTC, which is what we want.&lt;/p&gt;

&lt;p&gt;(Because the Hebrew day actually starts at sundown the previous day, we've got some "best effort" code in there that starts the day at 8PM.  Not ideal, but we're not looking up local sunsets and suchlike...  We also display something like "22 Sivan (Tuesday night and Wednesday)" to make it clear.)&lt;/p&gt;

&lt;p&gt;Yeah ok, so we have the local date, and we need to look up an entry in the calendar data.  Dates there use ISO format (YYYY-MM-DD).  So we get our Date object, which is supposed to be local, and call toISOString() on it.&lt;/p&gt;

&lt;p&gt;Guess what.  Date.toISOString &lt;em&gt;does not use the local time&lt;/em&gt;.  FFS.  I've been banging my head against a wall for two hours thinking it was something more esoteric, maybe having to do with that "start at 8PM" code (which I had actually commented out to eliminate that possibility).  I finally went to an online Javascript tester, one of those sites where you can type in code and run it, and confirmed that right now today.toISOString() says it's June 2 but today.getDay() says it's June 1.&lt;/p&gt;

&lt;p&gt;So now I have to &lt;s&gt;write&lt;/s&gt; Google for code that constructs the proper format for the &lt;em&gt;local&lt;/em&gt; time, which is down to padding numbers with leading zeros if the month or day number is less than 10 and string-munging and...ugh.  (Found it easily enough, but sheesh!)&lt;/p&gt;
&lt;br /&gt;&lt;br /&gt;&lt;img src="https://www.dreamwidth.org/tools/commentcount?user=cellio&amp;ditemid=2099761" width="30" height="12" alt="comment count unavailable" style="vertical-align: middle;"/&gt; comments</content>
  </entry>
</feed>
