<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: sesay</title>
    <description>The latest articles on DEV Community by sesay (@sesay).</description>
    <link>https://dev.to/sesay</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F95240%2F298a7cd5-c866-4dab-928d-c297418d86f9.jpeg</url>
      <title>DEV Community: sesay</title>
      <link>https://dev.to/sesay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sesay"/>
    <language>en</language>
    <item>
      <title>Working with date locale in your Cypress test</title>
      <dc:creator>sesay</dc:creator>
      <pubDate>Thu, 01 Oct 2020 16:23:23 +0000</pubDate>
      <link>https://dev.to/sesay/working-with-date-locale-in-your-cypress-test-1p4i</link>
      <guid>https://dev.to/sesay/working-with-date-locale-in-your-cypress-test-1p4i</guid>
      <description>&lt;p&gt;I recently came across a challenge when working with date locale's especially within the browser, and sometimes it could be very challenging there is a quick way around this using the &lt;code&gt;Intl.DateTimeFormat()&lt;/code&gt; &lt;a href="%5BresolvedOptions()%5D(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions)"&gt;more info&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But using the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions"&gt;resolvedOptions()&lt;/a&gt; in the &lt;code&gt;DateTimeFormat&lt;/code&gt; prototype method gives us more information and the browser locale is one of them.&lt;/p&gt;

&lt;h1&gt;
  
  
  Using Cypress
&lt;/h1&gt;

&lt;p&gt;I was tempted to actually run this cypress code, but the problem is this won't work unless its inside a test, for example an "it" block or in a Gherkin syntax if you using cucumber.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const dateLocale = () =&amp;gt; {
  let locale = '';
  cy.window().then(win =&amp;gt; {
    locale = win.navigator.language;
  });

  return locale;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  My Solution
&lt;/h1&gt;

&lt;p&gt;For me i prefer using the &lt;code&gt;Intl.DateTimeFormat().resolvedOptions()&lt;/code&gt; constructor object as this offer me flexibility and less code as i can easily extract the locale. An example code will look like this&lt;/p&gt;


&lt;div class="runkit-element"&gt;
  &lt;code&gt;
    
  &lt;/code&gt;
  &lt;code&gt;
    
const { locale: dateLocale } = new Intl.DateTimeFormat().resolvedOptions();

console.log(dateLocale); // logs the resolvedOptions() props

const date = Intl.DateTimeFormat(dateLocale).format(new Date());

console.log(date); // browser default locale date

  &lt;/code&gt;
&lt;/div&gt;



&lt;h1&gt;
  
  
  Final Words
&lt;/h1&gt;

&lt;p&gt;This is solely my opinion please feel free to drop your comment's in which approach do you think makes sense and how will you solve a problem like this.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you enjoyed the article, consider sharing it so more people can benefit from it! Also, feel free to follow me on Twitter &lt;a href="https://twitter.com/don_csay"&gt;@don_csay&lt;/a&gt; with your opinions.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>cypress</category>
      <category>testing</category>
      <category>coding</category>
    </item>
    <item>
      <title>Emails getting cut off in Gmail</title>
      <dc:creator>sesay</dc:creator>
      <pubDate>Sat, 24 Aug 2019 15:41:49 +0000</pubDate>
      <link>https://dev.to/sesay/emails-getting-cut-off-in-gmail-5232</link>
      <guid>https://dev.to/sesay/emails-getting-cut-off-in-gmail-5232</guid>
      <description>&lt;p&gt;Have you ever noticed your email been cut off in Gmail, this is because of the Email file size is larger than 102kb. A quick fix i found for this was to get rid of unwanted spaces in your HTML by using this tool &lt;a href="https://htmlcompressor.com/compressor"&gt;https://htmlcompressor.com/compressor&lt;/a&gt; this helps in stripping and optimising the file size to the barest minimum. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Please note:&lt;/strong&gt; the 102kb limit is based on the amount of content in the HTML code, not the size of specific images in your message. While resizing an image will not change the size of the content, deleting an image from the email body will reduce the size of the message.&lt;/p&gt;

</description>
      <category>gmail</category>
      <category>htmlemail</category>
      <category>css</category>
    </item>
  </channel>
</rss>
