Skip to content

Instantly share code, notes, and snippets.

@Stas-Buzunko
Last active August 7, 2018 08:06
Show Gist options
  • Save Stas-Buzunko/b5eb2ea3b125ee4a490224d92a1338dc to your computer and use it in GitHub Desktop.
Save Stas-Buzunko/b5eb2ea3b125ee4a490224d92a1338dc to your computer and use it in GitHub Desktop.
<strong>Watch the match live <strong>today, <span id="time-holder"></span>.</strong></strong>
<strong>Watch the match live <strong>next month, <span id="time-holder-1"></span>.</strong></strong>
<strong>Watch the match live <strong>in 2 month, <span id="time-holder-2"></span>.</strong></strong>
<script type="text/javascript">
(function() {
const date = new Date('8/2/2018 7:00:00 PM UTC');
const language = [];
const shouldReplaceCommas = false;
const options = {"month":"long","day":"numeric","hour":"2-digit","minute":"2-digit","weekday":"long", 'timeZoneName': 'short'};
let formatted = date.toLocaleDateString(language, options);
if (shouldReplaceCommas) {
formatted = formatted.replace(',', '');
}
document.getElementById('time-holder').innerHTML = formatted;
})()
</script>
<script type="text/javascript">
(function() {
const date = new Date('9/2/2018 7:00:00 PM UTC');
const language = ['es'];
const shouldReplaceCommas = false;
const options = {"month":"long","day":"numeric","hour":"2-digit","minute":"2-digit","weekday":"long", 'timeZoneName': 'short'};
let formatted = date.toLocaleDateString(language, options);
if (shouldReplaceCommas) {
formatted = formatted.replace(',', '');
}
document.getElementById('time-holder-1').innerHTML = formatted;
})()
</script>
<script type="text/javascript">
(function() {
const date = new Date('10/2/2018 7:00:00 PM UTC');
const language = ['tr'];
const shouldReplaceCommas = false;
const options = {"month":"long","day":"numeric","hour":"2-digit","minute":"2-digit","weekday":"long", 'timeZoneName': 'short'};
let formatted = date.toLocaleDateString(language, options);
if (shouldReplaceCommas) {
formatted = formatted.replace(',', '');
}
document.getElementById('time-holder-2').innerHTML = formatted;
})()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment