Orientação gerada a partir de informações públicas. Apenas para referência.
Jiffy é um pacote completo do Flutter para lidar com operações de data e hora em múltiplas plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux. Ele simplifica a análise, manipulação, consulta e formatação de datas com uma API intuitiva. Projetado para desenvolvedores que buscam uma solução leve, mas poderosa, o Jiffy suporta internacionalização e oferece sintaxe fluida para facilitar o manuseio de datas em aplicativos Flutter.
Jiffy.parse('2021/01/19').format(pattern: 'MMMM do yyyy, h:mm:ss a'); // January 19th 2021, 12:00:00 AMJiffy.now().format(pattern: 'EEEE'); // TuesdayJiffy.now().format(pattern: 'MMM do yy'); // Mar 2nd 21Jiffy.now().format(pattern: 'yyyy [escaped] yyyy'); // 2021 escaped 2021Jiffy.now().format(); // 2021-03-02T15:18:29.922343Jiffy.parseFromList([2020, 10, 19]).yMMMMd; // January 19, 2021Jiffy.parseFromMap({
Unit.year: 2020,
Unit.month: 10,
Unit.day: 19,
Unit.hour: 19
}).dMMMMEEEEyjm; // Monday, October 19, 2020 7:14 PM// You can also use pre-set formatsJiffy.parse('19, Jan 2021', pattern: 'dd, MMM yyyy').yMMMMd; // January 19, 2021Jiffy.now().yMMMMEEEEdjm; // Tuesday, March 2, 2021 3:20 PM
Relative Time
// From XJiffy.parse('1997/09/23').from(Jiffy.parse('2002/10/26')); // 5 years ago// From NowJiffy.parse('1997/09/23').fromNow(); // 25 years ago// To XJiffy.parse('1997/09/23').to(Jiffy.parse('2002/10/26')); // in 5 years// To NowJiffy.parse('1997/09/23').toNow(); // in 25 years
Manipulation
var jiffy = Jiffy.now().add(days: 1);
jiffy.yMMMMd; // March 3, 2021Jiffy.now().subtract(days: 1).yMMMMd; // March 2, 2021Jiffy.now()
.add(hours: 3, days: 1)
.subtract(minutes: 30, months: 1)
.yMMMMEEEEdjm; // Wednesday, February 3, 2021 6:07 PMJiffy.parse('1997/09/23')
.startOf(Unit.year)
.yMMMMEEEEd; // Wednesday, January 1, 1997Jiffy.parse('1997/09/23')
.endOf(Unit.month)
.yMMMMEEEEd; // Tuesday, September 30, 1997
// Get current locale code, by default it is en_usJiffy.now().localeCode; // en_US// Setting your preferred localeawaitJiffy.setLocale('fr_ca');
Jiffy.now().yMMMMEEEEdjm; // dimanche 26 février 2023 12 h 03awaitJiffy.setLocale('ja');
Jiffy.now().yMMMMEEEEdjm; // 2023年2月26日日曜日 12:02awaitJiffy.setLocale('zh_cn');
Jiffy.now().yMMMMEEEEdjm; // 2023年2月26日星期日 下午12:03
MIT LicenseCopyright (c) 2019JamaMohamedPermissionis hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Softwareis
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.