Skip to content

Commit

Permalink
Localize calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Jan 6, 2024
1 parent b2dae09 commit 08e50e3
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
66 changes: 66 additions & 0 deletions public/js/flatpickr/l10n/pt-pt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.pt = {}));
}(this, function (exports) { 'use strict';

var fp = typeof window !== "undefined" && window.flatpickr !== undefined
? window.flatpickr
: {
l10ns: {}
};
var Portuguese = {
weekdays: {
shorthand: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"],
longhand: [
"Domingo",
"Segunda-feira",
"Terça-feira",
"Quarta-feira",
"Quinta-feira",
"Sexta-feira",
"Sábado",
]
},
months: {
shorthand: [
"Jan",
"Fev",
"Mar",
"Abr",
"Mai",
"Jun",
"Jul",
"Ago",
"Set",
"Out",
"Nov",
"Dez",
],
longhand: [
"Janeiro",
"Fevereiro",
"Março",
"Abril",
"Maio",
"Junho",
"Julho",
"Agosto",
"Setembro",
"Outubro",
"Novembro",
"Dezembro",
]
},
rangeSeparator: " até ",
time_24hr: true
};
fp.l10ns.pt = Portuguese;
var pt = fp.l10ns;

exports.Portuguese = Portuguese;
exports.default = pt;

Object.defineProperty(exports, '__esModule', { value: true });

}));
4 changes: 4 additions & 0 deletions resources/views/partials/include_datepicker.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
{!! Minify::javascript(['/js/flatpickr/flatpickr.min.js', '/js/flatpickr/l10n/'.strtolower(Config::get('app.locale')).'.js']) !!}
{{-- Default config should be defined here because if "javascript" section is used when new datepicker is loaded it redefined the default config. --}}
@if (\Helper::isTimeFormat24())
@php $flatpickr_locale = preg_replace("#\-.*#", '', Config::get('app.locale')); @endphp
<script type="text/javascript" {!! \Helper::cspNonceAttr() !!}>
flatpickr.defaultConfig.time_24hr = true;
if (typeof(flatpickr.l10ns['{{ $flatpickr_locale }}']) != "undefined") {
flatpickr.localize(flatpickr.l10ns['{{ $flatpickr_locale }}']);
}
</script>
@endif
@endif
Expand Down

0 comments on commit 08e50e3

Please sign in to comment.